Guidance
指路人
g.yi.org
Software / Reginald / Examples / Menu.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/*
GUIBEGIN
WINDOW , 53, 175, 363, 138, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , Menu demo
	FONT 8, 400, MS Shell Dlg
	MENU
DEND

MENU
	HEADING &Test
		ITEM &Enable Test Item
		ITEM &Disable Test Item
		ITEM &Set Mark Item's Check
		ITEM &Clear Mark Item's Check
		ITEM
		ITEM Test Item, Test1Item
		ITEM Mark Item, Mark1Item, ,  MARK
	<
	HEADING &Test 2
		ITEM Toggle Test Item &On/Off
		ITEM Toggle Mark Item's &Check
		ITEM
		ITEM Test Item, Test2Item
		ITEM Mark Item, Mark2Item
	<
DEND
GUIEND
*/

LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')
again:
DO FOREVER
	guigetmsg()
	CATCH SYNTAX
			CONDITION('M')
			SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN


testenabletestitem:
	/* Enable "Test -> Test item" */
	guisetmenuopts("Test1Item", "")
	RETURN

testdisabletestitem:
	/* Disable "Test -> Test item" */
	guisetmenuopts("Test1Item", "GRAY")
	RETURN

testsetmarkitem_scheck:
	/* Set the checkmark on "Test -> Mark item" */
	guisetmenuopts("Mark1Item", "MARK")
	RETURN

testclearmarkitem_scheck:
	/* Clear the checkmark on "Test -> Mark item" */
	guisetmenuopts("Mark1Item", "")
	RETURN

test2toggletestitemon_off:
	/* If we already know whether the menu item is
	 * disabled/enabled, then we could simply specify
	 * the opposite state to toggle it. But let's assume we
	 * don't know whether it's enabled or disabled. So, we
	 * must first get its current state.
	 */
	guigetmenuopts("Test2Item", "MyVariable")

	/* Is it currently in GRAY or DISABLE state? */
	IF POS("GRAY", myvariable) \== 0 | POS("DISABLE", myvariable) \== 0 THEN DO

		/* It's currently GRAY or DISABLE, so remove these options from
		 * the current options in order to enable it.
		 */
		myvariable = CHANGESTR("GRAY", myvariable) 
		myvariable = CHANGESTR("DISABLE", myvariable) 
		guisetmenuopts("Test2Item", myvariable)
	END

	/* It's currently enabled, so add the "GRAY" option. We could alternately
	 * use the DISABLE option, but that simply disables the item without
	 * visually letting the user know that.
	 */
	ELSE guisetmenuopts("Test2Item", myvariable || "|GRAY")
	
	RETURN

test2togglemarkitem_scheck:
	/* If we already know whether the menu item is
	 * checked/unchecked, then we could simply specify
	 * the opposite state to toggle it. But let's assume we
	 * don't know whether it's checked. So, we must first
	 * get its current state.
	 */
	guigetmenuopts("Mark2Item", "MyVariable")

	/* Is it currently checked (ie, MARK option)? */
	IF POS("MARK", myvariable) \== 0 THEN DO

		/* It's currently checked, so remove the MARK option from
		 * the current options in order to uncheck it.
		 */
		myvariable = CHANGESTR("MARK", myvariable) 
		guisetmenuopts("Mark2Item", myvariable)
	END

	/* It's not checked, so add the "MARK" option. */
	ELSE guisetmenuopts("Mark2Item", myvariable || "|MARK")

	RETURN
掌柜推荐
 
 
¥420.00 ·
 
 
¥470.00 ·
 
 
¥890.00 ·
 
 
¥660.00 ·
 
 
¥748.00 ·
 
 
¥1,800.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:09