I suspect that your design is fundamentally wrong. You must not enter a loop 
and, inside this loop, ask whether the user has tapped on some button.

Instead, your form should be event-driven. That is, the event handler of your 
form should be invoked once (and once only) for every event that occurs while 
that form is active. It should process that event (which in most cases would 
mean simply to ignore it) and exit immediately - not spend lots of time in a 
loop.

When the application is designed this way, asking whether some button has been 
tapped merely means listening to the ctlSelectEvent event and reacting 
accordingly.

The counter-intuitive part about such a design is that (a) you must remember 
that any non-static variables have undefined values between events (e.g., don't 
expect to initialize them on frmOpenEvent and use them later on ctlSelectEvent) 
and (b) you must cut your loop into manageable pieces and execute only one 
piece on every nilEvent. It is very different from how non-event-driven 
environments work, which is why people new to the PalmOS environment often have 
some trouble grasping the concept. It helps if you have programming experience 
on the old MacOS or 16-bit Windows - they were also event-driven environments.

Regards,
Vesselin
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to