Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Context menus

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Context menus
#11737
Posted by: Michael S 2007-09-05 03:55:30
Is this WAD or an error Jeff

/*
GUIBEGIN


WINDOW , 0, 0, 400, 200, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
	FONT 8, 400, MS Shell Dlg
	ENTRY 100, 38, 139, 12, H_AUTO|BORDER|TABSTOP
	TEXT 35, 40, 55, 8, GROUP, , , , Text
DEND

MENU list
	HEADING List, List_menu
		ITEM Toggle, Toggle_menu
	<
DEND
GUIEND
*/

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 /* SELECT GuiObject */

	END /* Some child script signaled us */
	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 ?
Message2.
#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.
Message3. 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.
Message4.
#11762
Posted by: Jeff Glatt 2007-09-08 15:21:48
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.
Message5.
#11769
Posted by: chucksim 2007-09-08 22:07:35
So where is documentation on INITMENU ?
Chuck Simmons
Message6. I managed to guess and get gui to
#11771
Posted by: Michael S 2007-09-08 22:29:42
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 • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-4-14  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0