/* 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. */ OPTIONS "C_CALL LABELCHECK NOSOURCE" 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