HI Brad, this is a very simple fix.
in your select event loop when you want to quit just queue an custom event and don't handle it in your select event and let the glk_main handle it. You will need to put the code in the glk_main to handle the quit event. ----- Original Message ----- From: "Brad Jones" <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Saturday, February 07, 2004 6:57 PM Subject: A way to quit from within a program? > I am working on a PalmOS version of a UI library (Glk), and have run > into a problem I don't see an easy solution to. > > The issue is that the control flow for this library looks like this: > > PilotMain (provided by me) calls > glk_main (provided by author of Glk-using program) calls > glk_select (provided by me, handles event loop). > > Unfortunately, there is no easy way for me to tell glk_main 'Time to > quit now', and it may be nontrivial to hack in a 'Quit' event type due > to how the Glk-using program is implemented. (As an example in the > sample code, there is a function 'yes_or_no' that polls glk_select > until it gets a yes or no answer, and then returns a boolean. Adding a > 'Quit' event type would require changing the return type of this > function and checking for that everywhere it is called...and so on > until we get back out to glk_main.) Thus, if I get a > sysEventAppStopEvent, I have no easy way that I can see to properly > exit out of glk_select. (I could call SysUIAppSwitch, but that would > annoy the heck out of the users if they had exited via a hard button.) > > Is there either: a way for me to immediately exit as if I had returned > from PilotMain (equivalent of C library exit()), or an equivalent of > setjmp/longjmp that I can use to jump out of glk_select all the way to > PilotMain? > > BJ > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
