General information
Category:
Menus & Menu designer
Title:
Named menu bar problem, can't return to previous _msysmenu
In trying to isolate a problem with menus and modal forms I find that I cannot even return from a "named" menu bar to a pushed menu without both flicker AND having to destroy the named menu. Here is my test code. Can anyone tell me how to do it? I've included various alternatives that don't work.
As far as I can see named menu bars (which I assumed would be a nice simple way of having the right menubar around at the right time) just don't do what you expect? In a complete app I would expect to have several named bars and swap (quickly) between them as required. I would also want to restore the menu that existed before any named menu bar was activated. But that I can't do......
* How do you return from a named menubar to the most recent _msysmenu?
* (Using the stack, not by save)
* I don't think you can, except by destroying it. Which isn't really what I had in mind
push menu _msysmenu && Save original
define pad NP of _Msysmenu prompt "AddedToSysMenu"
Wait window "See modified _msysmenu. Key to see a different bar"
define menu TESTBAR bar
define pad testbar1 of testbar prompt "testbar1"
* Now, how do we get the saved menu back? Do a push if we use a pop laster
local lnTest
lnTest = 4
do case
case lnTest = 1
otherwise
push menu _msysmenu && Save current menu
endcase
activate menu testbar && Display the bar
Wait window "See a different bar. Key to HOPEFULLY see the modified _msysmenu redisplayed."
* Now, how do we get the saved menu back?
do case
case lnTest = 1
* This seems most likely? The reverse of "activate menu testbar"
activate menu _msysmenu nowait && Nowait seems to be required too
case lnTest = 2
* Well, perhaps the testbar IS the _msysmenu, so just a pop should do it
* This seems most likely? But it also has no effect.
pop menu _msysmenu
case lnTest = 3
* Well, maybe this is what "deactivate" is for?
deactivate menu testbar
pop menu _msysmenu
case lnTest = 4
* But this is the only thing that I get to work, why do I need to destroy the menubar!!
release menus testbar extended && This MUST be executed for pop to work
********* BUT this gives an unacceptable flicker!!!! *************
pop menu _msysmenu
case lnTest = 5
* Though this might avoid the flicker.
set sysmenu to
pop menu _msysmenu
endcase
* deactivate menu mainbar
Wait window "See modified _msysmenu. Key to see std _msysmenu (by a pop)"
pop menu _msysmenu
Wait window "See standard sysmenu. But just incase, key to see std _msysmenu (by a default)"
set sysmenu to default && Clear up cockups
return
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only