The Palm dynamic menu API doesn't let you do much, as you've discovered, 
and the multiple menu resources which are alternately shown or hidden
might work for you too, but if worse comes to worse, you can muck with
or rebuild the menu resource itself.  

I don't remember where I found the initial code example that got me going,
but if you're willing to create a new MenuBarType structure, populate it,
and keep it resident in memory, you can use
DmAttachResource/DmDetachResource combined with FrmSetMenu to dynamically
tweak your in-memory menubar, and then copy it to a resource and display
it.  I was doing this because I had a completely dynamic menubar for each
"screen" of my app, and so I basically built one of these things, attached
it, and then just blew it away and started fresh when a new screen came
in.  I don't think this is technically illegal in the brave new Palm OS 5
world, because I'm only accessing menubar internals before calling
FrmSetMenu, but it does require a lot of resource mucking.  It also might
not be the best solution for you because you know what your possible
permutations are; building menus in Constructor and switching between them
is probably a better use of your time.

If you (or anybody else) want to see code for doing this, let me know and
I will be happy to provide it; it's a little too hairy and too tied to the
rest of my app to just attach here, though.

-d


On Sat, 2 Mar 2002, Dave Mottorn wrote:

>       I have an application that needs to hide some menu choices under some
> circumstances.  It would be perfect if I could
> completely eliminate a menu on one form and hide two choices on a menu on
> another form.  I tried various combinations of MenuDispose, MenuHideItem,
> and FrmSetMenu but I couldn't get anything to work.  I saw a couple of
> threads on this going back as long as two years ago but I couldn't tell if
> anyone got these calls to work - much less how they did it.  Has anyone been
> able to modify menus on the fly?
> 
> regards,
> 
> Dave Mottorn
> 
> 
> 
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palmos.com/dev/tech/support/forums/
> 


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

Reply via email to