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

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

  
/*
GUIBEGIN
WINDOW , 328, 261, 231, 106, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , TREE demo
	FONT 8, 400, MS Shell Dlg
	TREE 7, 7, 218, 70, LINES|ROOT|BORDER, , MyTree, , MyItems
	PUSH 85, 86, 60, 14, TABSTOP, , Change, , Change Tree
DEND
GUIEND
*/

/* Demonstrates a Tree control. We have a Tree whose associated variable is "MyTree".
 * Its item variable is "MyItems".
 *
 * We initialize the tree to some items, and select one. We also have a "Change" button
 * which when clicked upon, changes the items in the Tree.
 */

LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1


/* Here are the items initially placed in the tree. We specified an item
 * variable name of "MyItems", so we initialize this stem variable
 * according to the REXX GUI docs for a Tree control. If we wanted the
 * Tree blank, we'd either DROP "MyItems.", or specify no item variable.
 *
 * NOTE: This must be done prior to GuiCreateWindow().
 */
myitems.1='P1'
myitems.1.1='C11'
myitems.1.2='C12'
myitems.2='P2'
myitems.2.1='C21'
myitems.2.2='C22'

/* Let's initially select Parent 1, Child 2. If we wanted no initial selection
 * then we'd either DROP this variable, or never set it to any value. Note:
 * We assume no LABEL style, so we initialize it by positions.
 *
 * NOTE: This must be done prior to GuiCreateWindow().
 */
mytree = "1 2"

guicreatewindow('NORMAL')
again:
DO FOREVER
   guigetmsg()
   CATCH HALT
   FINALLY
      guidestroywindow()
END
RETURN





/* Called by Reginald when the user clicks the Change button. */

wm_click_change:
/* Here Are the Tree items to be replaced. Note: We could use a different
 * stem variable if we wanted. We don't have to use MyItems. But if using
 * the same variable, it's best to DROP it first if you want to clear out
 * any old items. On the other hand, you could simply append new items in
 * order to retain the old ones. Or, pass a third arg of 1 to GuiAddCtlText
 * to retain the existing items in the Tree while appending some new ones.
 */
DROP myitems.
myitems.1='New1'
myitems.1.1='NewC11'
myitems.1.2='NewC12'
myitems.2='New2'
myitems.2.1='NewC21'
myitems.2.2='NewC22'
guiaddctltext("MyTree", "MyItems")

/* There is no more selected item. If we wanted to select an item, we could
 * call
 *
 * GuiSetCtlValue("MyTree", "2 1" /* whatever */)
 */

RETURN
掌柜推荐
 
 
¥288.00 ·
 
 
¥908.00 ·
 
 
¥289.00 ·
 
 
¥1,280.00 ·
 
 
¥1,360.00 ·
 
 
¥890.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:26