[EMAIL PROTECTED] wrote:
>
> >how can i detect that
> > the user has pressed the [menu] button - hence i stop
> > my animation until they have finished with the menu?
>
> This comes up every few months. This is a specific case of drawing to a
> window which is obscured. You want to draw only when the window you're
> drawing to is on top.
>
> [...]
>
> Can someone either paste the code one more time or look through
> www.egroup.com for prior messages?
This is what I have from that thread:
-------------------
From: [EMAIL PROTECTED]
Subject: Re: Correct way to use Menu?To: [EMAIL PROTECTED]
>What is the correct way to use Menu Resource? I have quite a few Menu
>bar and need to change the bars depending on context. I do the following:
OK, I'll talk about menus too, since it's another misunderstood area.
PalmOS best supports a model where each form has one menu. In fact,
each
form has a place to store which menu should be displayed for it.
When FrmSetActiveForm is called, it disposes any active menu and then
looks
at the form to be active and remembers which menu it wants to display.
But
it doesn't load the menu.
The menu resource gets loaded when a menuChr or a shortcut to a menu
item
is used. Once a form is loaded, the last item used is remembered the
next
time that menu appears. You can see by choosing a menu item, and press
the
menu again. The last operation is displayed incase the user wants to
repeat it or do something similar.
One side effect of this scheme is when a dialog appears over a form, the
form's menu is disposed of. This means the last menu item for the form
is
forgotten. Even if only an alert was dislayed.
PalmOS doesn't support many common menu operations. PalmOS doesn't
support
grayed out items. We prefer that the option exist and indicate when/why
it
can't be used at this time. PalmOS doesn't support state like
checkboxes.
The model we adopted uses dialogs instead to set preference options, for
those times when preferences really must be used. PalmOS doesn't
support
changing/adding menu items. It was deemed not neccessary to release the
product. To some extent this can be emulated by switching between
multiple
menus. To switch to another menu, you must:
1. Dispose of a menu if it's being used
2. Tell PalmOS to what menu to use if it needs to.
This does the first part:
menuP = MenuGetActiveMenu ();
if (menuP != NULL)
MenuDispose (menuP);
and this the second part:
MenuSetActiveMenuRscID (some menuRscId);
If you need to change the menu when the form is being opened, you must
do
this after FrmSetActiveForm, since that routine changes the menu to what
the form specifies.
All of this can be seen in the PalmOS source in Form.c and Menu.c.
-Roger Flores