Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Preset toggle menu

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Preset toggle menu
#11767
Posted by: Michael S 2007-09-08 16:19:25
I sent this offline while the forum was down, but I'll append it here as well so anyone else can potentially find it. Preset a toggle menu item, then try and "switch off" the toggle

/*
GUIBEGIN


WINDOW , 0, 0, 167, 57, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
	FONT 8, 400, MS Shell Dlg
	MENU
DEND

MENU
	HEADING Header
		ITEM Toggle, toggle_on_off, , AUTO
	<
DEND
GUIEND
*/

/* Load Rexx Gui functions. */
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow()
rc = post_create_window()
/* Now sync all the controls with their variables' values. */
guisetctlvalue()
guisetctlplacement(,,,,,,'NORMAL')

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
post_create_window:
guisetmenuopts('toggle_on_off', 'MARK')
RETURN 0
Message2.
#11773
Posted by: Jeff Glatt 2007-09-08 23:37:59
Don't use the AUTO option if you're going to manually set it.
Message3. Well, yes and no
#11775
Posted by: Michael S 2007-09-09 01:11:59
I want the AUTO option to be able to get it to toggle without me having to code that event. Then, when I'm going to process my application, I can pick up whether the toggle is set or not (since the GUIGETMENUOPTS will have the word string MARK in it if it's set).

So the question is, how do I get automatic toggling of a menu item AND ensure it's preset to "on".
Message4.
#11779
Posted by: Jeff Glatt 2007-09-09 04:36:32
You don't get automatic toggling, and ensure it's on. Automatic toggling is done everytime you select that item. If it was on, then it's off. If it was off, then it's on. That's it. You don't get to manually set it the way you want (or else things will likely get out of sync as both your script and REXX GUI fight over setting/clearing the checkmark).

So if you want to set it manually, don't use automatic toggling.
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