Thanks Peter and LionScribe.
Both hints have pointed into the right direction. A notification
launched application seems to be handled partially as a part of the
previously running application.
So the following things have to be considered.
1st: Before the EvtGetEvent loop:
FrmGotoForm needs to be replaced by (as it closes the form(s) of the
previous application as well):
pForm = FrmInitForm(FormID);
FrmSetActiveForm(pForm);
FrmSetEventHandler(pForm, FormEventHandler);
MemSet(&event, sizeof(event), 0);
event.eType = frmOpenEvent;
event.data.frmOpen.formID = FormID;
EvtAddEventToQueue(&event);
2nd: In the EvtGetEvent loop:
The following line (and the closing bracket) is no required as the
event handler has been installed before:
if (! MiniApplicationHandleEvent (&event)) {
3rd: After the event loop:
As suggested replace FrmCloseAllForms by a FrmEraseForm FrmDeleteForm
sequence (and what else is done for handling of the evtCloseEvent). For
whatever reason it didn't work to add an close event to the queue (no
more eventhandler existing?!).
4th: Track the previous current form and restore it afterwards (which I
already did before, but it wasn't sufficient as this form was also
closed).
Peter, I don't understand the purpose of our last line "Then use
FrmPopupForm to create your form.". Do you want to use this instead of
the FrmGotoForm before the loop. That crashed the application.
Cheers,
Goetz
"Peter Easton" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Try something like this:
>
> // Since this app's form is popped up, you cannot use
FrmCloseAllForms to get
> rid of it
> // You can also not use FrmReturnToForm because the previous form is
outside of
> the context
> // of this app. The solution is to do this all manually then, as it
is shown
> here.
>
> // Keep track of the active form of the previous app
> oldForm = FrmGetActiveForm();
>
> do {
> EvtGetEvent (&event, ticks);
>
> if (! SysHandleEvent (&event)) {
> if (! MenuHandleEvent (NULL, &event, &error)) {
> if (! MiniApplicationHandleEvent (&event)) {
> FrmDispatchEvent (&event);
> }
> }
> }
> } while (event.eType != appStopEvent);
>
> // Delete this form
> if ((syncForm = FrmGetActiveForm()) != NULL)
> {
> FrmEraseForm(syncForm);
> FrmDeleteForm(syncForm);
>
> // Make the previously active form the current one
> if (oldForm && syncForm != oldForm)
> FrmSetActiveForm(oldForm);
> }
>
> Then use FrmPopupForm to create your form.
>
> Regards,
>
> Peter
> http://www.whizoo.com
> Contractor for hire (PalmSource Certified Developer)
> Source code available for all apps
> Bluetooth Developer Kit for Palm OS
> BtSerial Pro - Serial Port Client for Palm OS
> BtSerial - Bluetooth Serial Port Client for Palm OS
> BtServer - Bluetooth Serial Port Server for Palm OS
> Net Sync - Programmatically manipulate network settings
> RegCode - Add registration code support to your app
>
>
>
> "Goetz Mueller" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Does anybody have an explanation for the difference of exiting a
> sysAppLaunchCmdNotify launched program section?
>
> Here's what I want to do and what I can observe:
>
> My application with a user interface shall be launched by a
> sysAppLaunchCmdNotify notification. It works perfectly if I handle
the
> corresponding form by FrmDoDialog with the appropriate event handler.
> However, it fails (ending in a blank screen and the need to press a
> hard app button and tap on the launcher button) after the application
> has exited (checked with Palm Reporter) if I use a traditional
> StartApplication->EventLoop->StopApplication sequence with a
> EvtGetEvent loop in its core. In order to verify that this sequence
> operates as it should I have called it instead of the
> sysAppLaunchCmdNormalLaunch application part. Here is works
perfectly,
> exiting the application and falling back to the launcher or the
> previously running application (yes, I know that's against the
> philosophy ;-) On the other hand if I call the
> sysAppLaunchCmdNormalLaunch application part in sysAppLaunchCmdNotify
> notification it ends again with the blank screen. The only way to
leave
> the notification to the previous application or the launcher seems to
> work when I avoid to use FrmGotoForm as it close the form of the
> previous application before I get the frmOpenEvent.
>
> The last idea that I now still have is to build a kind of dynamic UI
to
> avoid the FrmGotoForm which cause the 'resourced' form to get the
> frmOpenEvent.
>
> Any other ideas or reasons for this behaviour?
>
> Cheers,
> Goetz
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/