Sadly I ran into the same problem, and felt a bit frustated. But I found the way of changing the visible property in run time.
When VisualGLCD creates the code, it creates the Draw function for the object, but it is not really complete. Let me show you using a circle, for instance.
Code: Select all
#include "SmartGLCD_objects.h"
#include "SmartGLCD_resources.h"
//--------------------- User code ---------------------//
//----------------- End of User code ------------------//
// Event Handlers
void Circle1Click() {
RF6_bit = ~RF6_bit;
if (RF6_bit == 0)
Circle1.Visible = 0;
else
Circle1.Visible = 1;
DrawCircle(&Circle1);
}
In the Routine list within the project manager, you can see the DrawCircle function, double click it to jump to its code, you will see something like this:
Code: Select all
void DrawCircle(TCircle *ACircle) {
if (ACircle->Visible == 1) {
if (ACircle->Transparent == 1) {
T6963C_circle(ACircle->Left + ACircle->Radius,
ACircle->Top + ACircle->Radius,
ACircle->Radius, T6963C_WHITE);
}
else {
T6963C_Circle_Fill(ACircle->Left + ACircle->Radius,
ACircle->Top + ACircle->Radius,
ACircle->Radius, T6963C_WHITE);
}
}
}
And here is the problem. When the Visible property is set to 1, the function draws the circle, transparent or not, but when you set the Visible property to 0, it does absolutely nothing.
If you add a little piece of code to complement the if(Acircle->Visible == 1) statement the job will be done:
Code: Select all
void DrawCircle(TCircle *ACircle) {
if (ACircle->Visible == 1) {
if (ACircle->Transparent == 1) {
T6963C_circle(ACircle->Left + ACircle->Radius,
ACircle->Top + ACircle->Radius,
ACircle->Radius, T6963C_WHITE);
}
else {
T6963C_Circle_Fill(ACircle->Left + ACircle->Radius,
ACircle->Top + ACircle->Radius,
ACircle->Radius, T6963C_WHITE);
}
}
else {
T6963C_Circle_Fill(ACircle->Left + ACircle->Radius,
ACircle->Top + ACircle->Radius,
ACircle->Radius, T6963C_BLACK);
}
}
This is something the software must do on its own. I hope this is fixed soon.
Thanks...