/* 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 */ OPTIONS "C_CALL LABELCHECK" 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 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: /* Which label was previously selected? */ 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: parse arg tabvalue if datatype(tabname.0) \= 'NUM' then tabname.0=0 tabi=tabname.0+1 if arg(1,'E')=0 then tabvalue=TAB||tabi tabname.0=tabi tabname.tabi=tabvalue GuiAddCtlText("MyTab",tabvalue,tabi) MyTab = tabvalue /* Initially select this label. */ GuiSetCtlValue("MyTab") GuiGetCtlValue("MyTab") MyTab = tabvalue /* Initially select this label. */ 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: Call 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