Guidance
指路人
g.yi.org
Upload / Forum Attachment / Reginald Rexx Programming Language Compiler User Forum Attachments and Pictures / 13293-test.rex

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

  
/*
GUIBEGIN
WINDOW , 53, 175, 363, 138, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , Menu item add/remove demo
	FONT 8, 400, MS Shell Dlg			
	GROUP 6, 6, 222, 47, , , , , GuiAddMenu()
	PUSH 14, 19, 43, 25, MULTI|TABSTOP, , Add1, , Add Heading 3
	PUSH 66, 19, 43, 25, MULTI|TABSTOP, , Add2, , Add Heading before 2
	PUSH 116, 19, 43, 25, MULTI|TABSTOP, , AddItem1_3, , Item at 1 3
	PUSH 167, 19, 43, 25, MULTI|TABSTOP, , Heading1_5, , Heading at 1 5
	GROUP 6, 60, 221, 47, , , Del1, , GuiRemoveMenu()
	PUSH 14, 75, 43, 25, MULTI|TABSTOP, , Del1, , Heading at 1 5
	PUSH 66, 75, 43, 25, MULTI|TABSTOP, , Del2, , Item "MySub2"
	PUSH 116, 75, 43, 25, MULTI|TABSTOP, , Del3, , Heading at 2
DEND

MENU List	
	HEADING &Heading 1
		ITEM Item &1
		HEADING Item &2
			ITEM Sub 1
			ITEM Sub 2, MySub2
		<
		ITEM
		ITEM Item &4
		ITEM Item &5
	<
	HEADING H&eading 2
		ITEM Item &1
		ITEM Item &2
	<
DEND
GUIEND
*/

/* This script demonstrates adding new headings and items to a menu on-the-fly.
 * We call GuiAddMenu() to do this, specifying a "HEADING" or "ITEM" option
 * (depending upon whether we're adding a heading or a selectable menu item).
 * When adding a menu item, we must know the "position" at which it falls.
 */
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1

guicreatewindow('NORMAL')

again:
DO FOREVER

	guigetmsg()
	CATCH SYNTAX
			CONDITION('M')
			SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN

wm_click_add1:
	/* Add a heading at a position of 3. Note that if there's
	 * a problem, SYNTAX will be raised since we set GuiErr for that.
	 */
	guiaddmenu("Heading 3", "HEADING", "3 0")
	guiaddmenu('List','POPUP')
	
	
	/* Disable the button so he can't click it again. */
	guisetctlplacement("Add1", , , , , "DISABLE")
	RETURN

wm_click_add2:
	/* Add a heading at a position of 2. Note that since there
	 * is already a heading at position 2 (ie, "Heading 2"),
	 * this will be inserted before that heading (and "Heading 2"
	 * will consequently be pushed to a position of 3).
	 */
	guiaddmenu("Before 2", "HEADING", 2)

	/* Disable the button so he can't click it again. */
	guisetctlplacement("Add2", , , , , "DISABLE")
	RETURN

wm_click_additem1_3:
	/* Add an item at a position of 1 3. This means it will
	 * fall under the heading at a position of 1 (ie, "Heading 1").
	 * It will be placed at a position of 3. Since we already have
	 * an item at position 3 (ie, the separator line), this will be
	 * inserted before that separator line (and the remaining items
	 * under "Heading 1" will have their positions incremented.
	 *
	 * Note: The item has a caption of "Inserted 1", and has the
	 * MARK option.
	 */
	guiaddmenu("Inserted 1, , , MARK", "ITEM", "1 3")

	/* Disable the button so he can't click it again. */
	guisetctlplacement("AddItem1_3", , , , , "DISABLE")
	RETURN

wm_click_heading1_5:
	/* Add an heading at a position of 1 5. This means it will
	 * fall under the heading at a position of 1 (ie, "Heading 1").
	 * It will be placed at a position of 5.
	 *
	 * Note: The item has a caption of "Heading insert".
	 */
	guiaddmenu("Heading insert", "HEADING", "1 5")

	/* Add an item at a position of 1 5 1. This means it will
	 * fall under the heading we just added above.
	 */
	guiaddmenu("Inserted sub", "ITEM", "1 5 1")

	/* Disable the button so he can't click it again. */
	guisetctlplacement("Heading1_5", , , , , "DISABLE")
	RETURN

wm_click_del1:
	/* Delete the 5th item under the first heading. Note:
	 * If the item doesn't exist, GuiRemoveMenu() does not
	 * consider this an error. So it will not raise SYNTAX
	 * in this case.
	 */
	guiremovemenu("1 5")

	/* Disable the button so he can't click it again. */
	guisetctlplacement("Del1", , , , , "DISABLE")
	RETURN

wm_click_del2:
	/* Delete the menu item associated with the variable
	 * "MySub2". It can be any position. Therefore, this
	 * a very easy way of deleting an item.
	 */
	guiremovemenu("MySub2", "VAR")

	/* Disable the button so he can't click it again. */
	guisetctlplacement("Del2", , , , , "DISABLE")
	RETURN

wm_click_del3:
	/* Delete menu heading 2 (and all items/sub-items under it. */
	guiremovemenu("2")

	/* Disable the button so he can't click it again. */
	guisetctlplacement("Del3", , , , , "DISABLE")
	RETURN

掌柜推荐
 
 
¥1,390.00 ·
 
 
¥287.00 ·
 
 
¥410.00 ·
 
 
¥1,380.00 ·
 
 
¥1,080.00 ·
 
 
¥271.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-03-30 02:00:01