"Bodo Wenzel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Why does the state need to be tracked?
It seems to me that once we ensure that all opened/opening command bars have
at least 1 icon, then any time we want to check the status of the command
bar (in my case this is very, very, very rarely), we can just use
"CmdBarOpen = MenuCmdBarGetButtonData(...)" right then, right?  It seems to
me that the original method would be useful only if we are going to be
testing CmdBarOpen many, many, many times for the few seconds the menu can
be open.  This would seem like an impossible circumstance, though!

Also, wouldn't it be better to only add the icon if it is required?
Wouldn't the following code tweak be better (I am not going to try it
because I am assured there will always be at least 1 icon because my form is
filled with 1 field and alway has at least the "Copy" icon):

> /* somewhere in the event loop: */
>
>   /* track opened command bar on OS 3.5 and greater */
>   if (CmdBarOpen) {
>     if (!MenuCmdBarGetButtonData (0, NULL, NULL, NULL, NULL)) {
>       /* this works only if at least one icon is shown */
>       CmdBarOpen = false;
>     }
>   }
>
> /* in the switch that dispatches the events: */
>
>   case menuCmdBarOpenEvent:
>     CmdBarOpen = true;
if (!MenuCmdBarGetButtonData(0, NULL, NULL, NULL, NULL))
{ // OOPS!  Command Bar is open but no icons are there!  Add one now!
>     MenuCmdBarAddButton(menuCmdBarOnRight, Bar/*some*/Bitmap,
> menuCmdBarResultMenuItem,
> menuId/*some*/, NULL);
}
>     return false;



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to