/* GUIBEGIN WINDOW , 15, 109, 559, 338, POPUP|CAPTION|SYSMENU|MINBOX, , Window Title FONT 8, 400, MS Shell Dlg TAB 6, 60, 546, 248, SINGLELINE|RIGHTJUSTIFY, , MyTab PUSH 510, 318, 40, 14, DEFAULT|TABSTOP, CLIENTEDGE, RUN, , RUN COMBO 11, 10, 538, 40, SIMPLE|VSCROLL|TABSTOP, , Command PUSH 6, 51, 27, 9, TABSTOP, , NewTab, , +Tab PUSH 33, 51, 27, 9, TABSTOP, , RemoveTab, , -Tab DEND GUIEND */ LIBRARY rexxgui GuiErr = "SYNTAX" GuiHeading = 1 /* To use the HTML control, we need to initialize support for it with GuiWindowDefaults */ GuiWindowDefaults(, , , , "HTML") /* 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() GuiSetCtlPlacement(,,,,,,'NORMAL') /* Init application procedures */ command.0 = 0 tabname.0 = 0 tabmax = 0 AddNewTab() AddTabCtls() MyOldTab = MyTab /* End of Init */ 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 /* * User requested change of tab control * */ WM_SELCHANGE_MyTab: /* Get the selected label's text */ GuiGetCtlValue("MyTab") /* 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 /* * Remove controls of active control * */ RemoveTabCtls: /* Get previously selected label */ GuiGetCtlValue(MyOldTab) GuiRemoveCtl(MyOldTab) RETURN /* * Add HTML control to current TAB * */ AddTabCtls: GuiAddCtl("HTML 9, 76, 538, 228, , CLIENTEDGE, "||MyTab||",, ") RETURN /* * Add new TAB Control * */ AddNewTab: /* Increment # of tabs, since we're adding another */ tabi = tabname.0 + 1 tabname.0 = tabi /* Form the name of the variable associated with this tab. It will be TABx * where x is the tab number */ tabvalue = "TAB" || tabi tabname.tabi = tabvalue /* Add the tab, with its associated variable */ GuiAddCtlText("MyTab", tabvalue, tabi) /* Select this tab */ MyTab = tabvalue GuiSetCtlValue("MyTab") /* GuiGetCtlValue("MyTab") */ MyTab = tabvalue tabmax = tabmax + 1 RETURN /* * Remove TAB Control * */ RemoveTab: IF tabmax <= 1 THEN RETURN DO i = 1 TO tabname.0 IF mytab = tabname.i THEN DO tabname.i = '' LEAVE END END GuiRemoveCtlText("MyTab","") tabmax = tabmax - 1 DO i = 1 TO tabname.0 IF tabname.i \= '' THEN DO mytab = tabname.i LEAVE END END AddTabCtls() GuiSetCtlValue("MyTab") GuiGetCtlValue("MyTab") RETURN /* * User selected command from Combo * */ WM_OK_Command: WM_SELECT_Command: RunCommand() RETURN /* * User entered command in Combo * */ WM_CLICK_RUN: RunCommand: error = GuiGetCtlValue("Command") IF error \== "" THEN RETURN IF EXISTS("command") == 0 THEN RETURN IF STRIP(command) = '' THEN RETURN maxi = command.0+1 si = 0 DO i=1 TO command.0 IF command.i = command THEN DO si=i LEAVE END END IF si=0 THEN DO command.0 = maxi command.maxi = command END GuiAddCtlText("Command", "Command") INTERPRET myTab || '="http://" || command || "/"' GuiSetCtlValue(mytab) RETURN /* * User requested new tab * */ WM_CLICK_NewTab: AddNewTab() RETURN /* * User requested remove of tab * */ WM_CLICK_RemoveTab: RemoveTab() RETURN