| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. Context menus #11737 | Is this WAD or an error Jeff
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
sw_toggle = 0
again:
DO FOREVER
guigetmsg()
IF EXISTS('GuiObject') == 0 THEN DO
IF EXISTS('GuiSignal') THEN DO
END
END
ELSE DO
IF EXISTS('GuiSignal') == 0 THEN DROP (guiobject)
ELSE SELECT guiobject
WHEN 0 THEN NOP
OTHERWISE
END
END
CATCH SYNTAX
CONDITION()
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
wm_contextmenu:
guiaddmenu('List')
RETURN
toggle_menu:
IF sw_toggle = 0 THEN
DO
SAY 'Setting a MARK for toggle_menu'
guisetmenuopts('Toggle_menu', 'MARK')
sw_toggle = 1
END
ELSE
DO
SAY 'Clearing toggle_menu'
guisetmenuopts('Toggle_menu', '')
sw_toggle = 0
END
RETURN
Run the script, right-click on the TEXT text and select the toggle popup menu. I'm getting an undefined control in the toggle_menu procedure. Is this a bug ? | 2. #11749 Posted by: Jeff Glatt 2007-09-08 13:55:34 Last edited by: Jeff Glatt 2007-09-08 13:59:43 (Total edited 1 time) | As soon as a popup menu's item is chosen, then the pop-up menu is destroyed. You can't change the state of something that no longer exists.
I presume what you're trying to do is alter the state of a item before the popup menu is shown? As I recall, you do that from an INITMENU event handler. | 3. It's not a problem for me #11760 Posted by: Michael S 2007-09-08 15:18:48 Last edited by: Jeff Glatt 2009-03-04 15:08:04 (Total edited 1 time) | I want to be able to present a popup menu to the user that allows him to toggle a menu item on this menu (and for this to be shown next time).
I guess the answer is that I have to note if he selected the toggled item, save this fact, and show the item as toggled the next time I show the popup menu. | 4. #11762 | Yes, that's it. The INITMENU event is there to initialize any menu items, based upon the (changing) state of your variables, before the menu is shown.
For example, RPC uses this to disable various Debugger menu items, depending upon whether a script is loaded, whether a script is running or paused at a breakpoint, etc. | 5. #11769 | So where is documentation on INITMENU ? Chuck Simmons | 6. I managed to guess and get gui to #11771 | run through a procedure called WM_INITMENU (after it's run through wm_contextmenu), but I couldn't figure out how to affect the toggle mark on the menu option. Any attempts to guisetmenuopts failed miserably | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|