At 05:45 PM 1/17/2005, you wrote:
Update: when running Palm OS 4.12 on the emulator, SysUIAppSwitch only carries control back ONCE to App A (the original caller). When running Palm OS 3.5, the SysUIAppSwitch will keep re-launching App A continually after App B has quit, no matter how many times I quit App A, until I click on the App Launcher.

As a minimum, this tells me that SysUIAppSwitch's behaviour is not well-defined. Maybe in OS5, 6, etc., this has been resolved.

I guess the question becomes: does anyone know another way to switch between apps "cleanly" in OS 4 and lower, i.e. without jumping back?

The key idea is that there is always a user programming running in Palm OS. There's also an internal variable to the OS that tells it what to launch when the current program quits.


SysUIAppSwitch does exactly two things:

1) set the internal variable for the program that you specify, including setting up launch codes and parameter block
2) post an appStopEvent to the queue


When your program ends after handling the appStopEvent, the OS launches the program specified in the globals. As part of this code, the OS puts the info on the last program run into the globals, so if the newly launched program ends without a new call to SysUIAppSwitch, it will return to the original program.

So in the scenario A switches to B, there's no way for A to tell the system what to do. The user can cause his own SysUIAppSwitch to occur by hitting a hard key and having the system handle the key press, and usually, app B doesn't have any other mechanism to cause it to end.

The ultimate problem is that you've got an app B that has a QUIT function. Palm OS apps aren't supposed to support that, and if they do, they shouldn't just quit but instead should switch to the launcher or some other application.


-- Ben Combee, Technical Lead, Developer Services, PalmSource, Inc. "Combee on Palm OS" weblog: http://palmos.combee.net/ Developer Forum Archives: http://news.palmos.com/read/all_forums/



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

Reply via email to