If you've a *lot* of processing to do in response to a button tap, is there
any way to stop the system from appearing frozen? Specifically, respond to
silk screen taps or 'Cancel' button taps?
Code resembles the following:
Boolean MyEventHandler(EventPtr eventP) {
Boolean handled;
switch (eventP->eType) {
case ctlSelectEvent:
switch (eventP->data.ctlSelect.controlID) {
case MainGoButton:
slow_func();
handled = true;
break;
case MainCancelButton:
FrmGotoFrom(SomewhereElseForm);
handled = true;
break;
}
break;
}
return handled;
}
When the slow_func() is executing, events are being queued but the main
event loop isn't getting to process them. Calling EvtEventAvail() in
slow_func() will indicate if there is an event queued, but is there any way
of telling what event it is? If I call EvtGetEvent() I'll effectively have
to write a whole new event handler in slow_func() which would not be
elegant, even if it did work.
In a multi-threaded the event handler could set a global flag to tell other
threads to quit, but user applications are singled-threaded under Palm OS, yes?
As always, any suggestions would be appreciated.
-PG.