This is what they (PalmOS) recommend.  Note that the code doesn't
necessarily detect a menu, but any other window that get displayed on top of
the main window.


(Straight from the PalmOS Programmer's Companion, vol 1)
The recommended way to do this is to stop drawing when you receive a
winExitEvent matching your drawing window and resume drawing when you
receive the corresponding winEnterEvent.  For example, the following code is
excerpted from the Reptoids example application's main event loop:

EvtGetEvent (&event, TimeUntillNextPeriod());
if (event.eType == winExitEvent) {
  if (event.data.winExit.exitWindow == (WinHandle) FrmGetFormPtr(MainView))
{
    // stop drawing.
  }
}
else if (event.eType == winEnterEvent) {
  if (event.data.winEnter.enterWindow == (WinHandle) FrmGetFormPtr(MainView)
&&
      event.data.winEnter.enterWindow == (WinHandle) FrmGetFirstForm ()) {
    // start drawing
  }
}


"LionScribe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I would try something like this:
>
> menuUp = WinGetActiveWindow() == (WinHandle)MenuGetActiveMenu();
>
> I didn't try this, but I believe that the MenuBarType pointer can be
casted
> to a WinHandle since it's first value is it's winHandle. I just wonder if
it
> will break in future OS.
>
> LionScribe
>
> "Tim Kostka" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I was able to do this with the statment:
> >
> >     menuUp = WinGetActiveWindow() !=
> FrmGetWindowHandle(FrmGetActiveForm());
> >
> > For my purposes, it works fine, but I'm sure there's instances in which
it
> > will return a true value if a window other than the menu is on top of
the
> > active form.
> >
> >
> > "Tim Kostka" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Is there an easy way to detect if the menu is currently displayed?
The
> > only
> > > way I can think of to determine if it's up is to catch winEnterEvent
and
> > > winExitEvent and see if the menu is being entered/exited.
> > >
> > > --
> > > Tim Kostka
> > > http://www.nuprograms.com
> > >
> > >
> > >
> >
> >
> >
>
>
>



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

Reply via email to