/* GUIBEGIN STRING ListStrings My string Another string One more DEND STRING TabStrings One Two Three DEND WINDOW , 91, 221, 197, 199, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , TAB example FONT 8, 400, MS Shell Dlg TAB 5, 3, 187, 108, SINGLELINE|RIGHTJUSTIFY|NOFOCUS, , MyTab, , TabStrings DEND GUIEND */ /* This is an example of a Main Window Layout script. It contains a TAB * control with the labels "One", "Two", and "Three". When the user * selects "One", we create a ENTRY control and a PUSH button, and operate * it. When the user selects "Two", we create 4 check controls. When the * user selects "Three", we create a listbox containing some preset strings. */ /* Before opening the window, let's initialize the variables for our TAB * control, and each label's set of controls. */ MyTab = "One" /* Initially select this label. */ TwoCheck1 = 1 /* Initially check this box. */ MyOldTab = "One" /* Standard initialization and message loop, with one exception as regards * GuiCreateWindow below. */ OPTIONS "C_CALL NOSOURCE LABELCHECK" LIBRARY rexxgui GuiErr = "SYNTAX" GuiHeading = 1 /* Normally, we call GuiCreateWindow('NORMAL'). This creates and displays * the window. But we don't want to display the window after it is created. * Why? Because we still have some more controls to add to it first. We * call AddTabCtls() to do that. Then we call GuiSetCtlPlacement to finally * display the window. */ GuiCreateWindow() AddTabCtls() GuiSetCtlPlacement(,,,,,,'NORMAL') Again: DO FOREVER GuiGetMsg() /* None of our handlers below calls GuiWake(). Plus, we use no child window * Layout scripts. So we omit any checks of GuiObject/GuiSignal. */ CATCH SYNTAX CONDITION('M') SIGNAL Again CATCH HALT FINALLY GuiDestroyWindow() END RETURN /* Called by Reginald when the user clicks the "OnePush" PUSH control. * NOTE: This was manually added. Because the "OnePush" is created * via GuiAddCtl, we don't actually have it in any window when we * create this script. So we have no Properties dialog to click on * the "Add Event Handler" button. * * So, we just prepend WM_CLICK to the control's variable name. */ WM_CLICK_OnePush: GuiSay("Button clicked. Changing the label of 'One'.") RETURN /* Called by Reginald when the user selects a new TAB label. */ WM_SELCHANGE_MyTab: /* Get the selected label's text (ie, "One", "Two" or "Three"). */ GuiGetCtlValue("MyTab") /* Display a set of controls depending upon which TAB label * has been selected. The variable "MyTab" has been set to * the currently chosen label. "MyOldTab" has been set to * the previously chosen label, or DROP'ed if there was no * previously chosen label. */ /* First remove any controls that were displayed for the * previously chosen TAB label, if any. */ RemoveTabCtls() /* Now add the set of controls for the new TAB label. */ AddTabCtls() /* Save the current TAB label as the previous label too. */ MyOldTab = MyTab RETURN /* Called by WM_SELCHANGE_MyTab to remove a set of controls for a TAB label. * NOTE: Before we destroy the controls, we call GuiGetCtlValue to update * the control's associated variable. In this way, the next time we create * the control, its variable will have an updated value, and it will be * initialized to that. */ RemoveTabCtls: /* Which label was previously selected? */ SELECT MyOldTab WHEN "One" THEN DO GuiGetCtlValue("OneEntry") GuiGetCtlValue("OnePush") GuiRemoveCtl("OneEntry") GuiRemoveCtl("OnePush") END WHEN "Two" THEN DO GuiGetCtlValue("TwoCheck1") GuiGetCtlValue("TwoCheck2") GuiGetCtlValue("TwoCheck3") GuiGetCtlValue("TwoCheck4") GuiRemoveCtl("TwoCheck1") GuiRemoveCtl("TwoCheck2") GuiRemoveCtl("TwoCheck3") GuiRemoveCtl("TwoCheck4") END WHEN "Three" THEN DO GuiGetCtlValue("ThreeList") GuiRemoveCtl("ThreeList") END OTHERWISE /* If no label was previously selected, MyOldTab = "MYOLDTAB" */ END RETURN /* Called by WM_SELCHANGE_MyTab to add a set of controls for a TAB label. */ AddTabCtls: /* Which label is selected? */ SELECT MyTab WHEN "One" THEN DO GuiAddCtl("ENTRY 10,20,176,14, TABSTOP, CLIENTEDGE|QUIET, OneEntry") GuiAddCtl("PUSH 76,40,50,16, DEFAULT|TABSTOP, , OnePush, , Ok") END WHEN "Two" THEN DO GuiAddCtl("CHECK 10,24,50,14, AUTO, QUIET, TwoCheck1, , Option 1") GuiAddCtl("CHECK 70,24,50,14, AUTO, QUIET, TwoCheck2, , Option 2") GuiAddCtl("CHECK 10,44,50,14, AUTO, QUIET, TwoCheck3, , Option 3") GuiAddCtl("CHECK 70,44,50,14, AUTO, QUIET, TwoCheck4, , Option 4") END WHEN "Three" THEN DO GuiAddCtl("LIST 10,20,176,90, TABS|BORDER, CLIENTEDGE|QUIET, ThreeList,, ListStrings") END END RETURN