Folks,
Some time ago I ran into the issue where the screen is not restored after a
popup alert goes away. This effects me since I do a lot of custom drawing
on forms. It is particularly an issue on the Symbol units ... after the
scanMgr library is loaded, a fellow only has about 5K of dynamic memory to
work with. (the SPT1700's seem to be the most restrictive in this regard).
Anyway, I "solved" the problem by wrapping the FrmCustomAlert() routine as
follows:
Word MyFrmCustomAlert(Word alertID, CharPtr arg1, CharPtr arg2, CharPtr
arg3)
{
ULong freeP= 0;
ULong maxP= 0;
Err err= MemHeapFreeBytes (0,&freeP,&maxP);
Word rval= FrmCustomAlert(alertID,arg1,arg2,arg3);
if (freeP <= REDRAW_BYTES_NEEDED)
{
EventType event;
MemSet (&event, sizeof(EventType), 0);
event.eType = (events)USER_REDRAW
EvtAddEventToQueue (&event);
}
return rval;
}
If my active form recieves the USER_REDRAW event, then I redraw the screen
myself. This approach assumes that the the OS requires some dynamic memory
to capture the bits under the popup so that it can restore them once the
popup goes away. Of course, I'd like to avoid redrawing twice ... ugly
flash, and more importantly I want to be sure to redraw when necessary.
The approach "almost" works perfectly ... e.g. ~95% of the time. I've
played with the const for REDRAW_BYTES_NEEDED (started at 3200 = 160x160 /
8), and it's currently set at 3600. I've also tested agains maxP rather
than freeP. I'd like to find a 100% reliable solution (other than bumping
the const or always redrawing), so ...
Question: How can I determine precisely whether or not the OS is going to
restore my bits? (I don't have the OS Source)
Regards,
[EMAIL PROTECTED]
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/