>...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


Reply via email to