Thanks David. I had actually sort of tried this before and it crashed (I
suspect that it would have for a non-debug ROM also given that the crash was a
bus error). One thing that I wasn't doing though was calling FrmSetActiveForm
prior to FrmDrawForm. I've now re-compiled and am re-testing. I'll let you
know if things go wrong!
Kind regards,
Christopher
David Fedor wrote:
> >...do some stuff
> >
> > mFormSentry = FrmDeleteFormSentry(0); // Calls FrmDeleteForm
> > if (mPreviousWinHandle)
> > {
> > ::WinSetDrawWindow(mPreviousWinHandle);
> > ::WinSetActiveWindow(mPreviousWinHandle); // THIS BIT HAS HAD TO BE
> >ADDED
> > }
>
> Instead of calling the two Window manager routines, just call
> FrmSetActiveForm() giving it the previously active form (if any).
> Otherwise you have activated a window without the form manager knowing
> about it. FrmSetActiveForm() does a bunch of stuff, including restoring
> the previous bits, letting the Graffiti shift indicator know what's going
> on, sets focus appropriately...
>
> So your code, in order to cleanly put up a form over something and then
> take it back down again, without going through the normal event loop
> mechanisms, should look like this:
>
> curFrm = FrmGetActiveForm ();
> frm = FrmInitForm (waitDialog);
> FrmSetActiveForm (frm);
> FrmDrawForm (frm);
>
> //... do stuff ...
>
> FrmEraseForm (frm);
> FrmDeleteForm (frm);
>
> if (curFrm)
> FrmSetActiveForm (curFrm);
>
> (This was in fact taken from the way that the launcher does its "Please
> wait" dialog.)
>
> As for why it used to work - well, it would sort of have worked, except for
> all the other things that FrmSetActiveForm() would have done. Yet another
> reason to use the debug 3.5 roms, since they help you catch great things
> like this, as you've just found! I bet that running your app on a release
> 3.5 rom would have worked as before, right?
>
> -David Fedor
> Palm Developer Support
--
Christopher Hunt
Class Action Pty. Ltd.
Complete time zone management for the Palm(tm) connected organizer.
Check out http://www.classactionpl.com/