Hi,
I want to change the text of the lables on my form and I cannot seem to do that. I used FsetText but that did not work. My code looks like this:
main() {
//Create Form1
//populate Form1 with widgets (Buttons, Labels etc)
//Create Form2
//populate Form2 with widgets (Buttons, Lables etc)
//Show Form1
Fctl(DRAW, Form1);
//start event loop
while(1) {
...
...
case SHOWFORM2:
//populate Labels in Form2
//show Form2
Fctl(DRAW, FORM2);
break;
...
...
}
}
In "populate Labels in Form2", I get data from DB and then use that to set the Label values as follows:
{
pointer p;
p = Array(...);
...
DBgetrec(...);
alert(p[0]);
FsetText(LABEL0, p[0]);
alert(p[1]);
FsetText(LABEL1, p[1]);
alert(p[2]);
FsetText(LABEL2, p[2]);
...
...
}
The alert() confirms that data is correctly been retrieved from DB. Only that FsetText does not seem to work.
When run, the Form2 displays with the original values that were assigned when creating the labels with Label() method.
I have got around this problem, but I do not like the solution. To get round the problem, I do not instantiate Form2 in main() immediately after Form1. I instantiate Form2 in event loop. When the event occurs, I get info from DB, instantiate Form2, populate it with widgets and assign text obtained from DB as default text.
This works OK, but then forces me to keep tracks of all active forms and then destroy them. I like the simplicity of creating all forms beforehand and then reassigning different values to widgets at runtime.
By the way, you already know that these are dynamic forms. PToolBox v7.6.1.
Any suggestions?