Page 1 of 1

PostPosted: Tue Jan 24, 2006 9:29 pm
by tthkbw
I have a simple form with a four buttons. A menu item on this form loads another form with form.domodal().

Everything was working well, then I added some stuff to the AppPrefs structure for initialization.

At some point, the mainForm.load() didn't draw the form, although the form and controls are actually there. The screen is blank, but if you tap where a button is, the event is registered and the button.onselect() function executes and runs properly. Alerts also show properly.

If I select the menu item to load the other form with the form.domodal() call, the second form loads properly and controls are visible. When I exit the modal form, the original form now draws properly.

I tried putting in a form.redraw() in the form.onopen for the main form, but nothing changes.

Any idea what might be going on?

Terry Brown


PostPosted: Tue Jan 24, 2006 9:43 pm
by tthkbw
Well, I kept hacking away at this and now it works. Here's what I did--don't know yet if I'm good, or just lucky :)

Part of the appPrefs I save are button labels. In the onopen method for the form, I set the button labels to the values in the appPrefs structure. I also initialize a draw object with draw.attachForm(mainForm) in the onopen method.

When I added the setting of the button labels, I added it before the draw.attachForm(mainForm). When the code was executed in this order, the form didn't draw.

However, when I moved the draw.attachForm(mainForm) to before the setting of the button text, everything started working again.

Does this make sense? If so, how do I learn this stuff without just stumbling into it and hacking away until I find the magic incantation?

Terry Brown


PostPosted: Wed Jan 25, 2006 4:05 am
by dewey
The order in which you call attachForm shouldn't make any difference. Hmmm...

PostPosted: Wed Jan 25, 2006 9:35 am
by FrankG
Hmmm... I have a draw.attachform in my form.onopen handler in the problem described here


PostPosted: Thu Jan 26, 2006 3:47 am
by dewey
draw.attachform should be in your onopen handler - that is the correct spot.