LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
guiwindowdefaults(, , , , "HTML")
guicreatewindow()
guisetctlplacement(,,,,,,'NORMAL')
command.0 = 0
tabname.0 = 0
tabmax = 0
addnewtab()
addtabctls()
myoldtab = mytab
again:
DO FOREVER
guigetmsg()
CATCH SYNTAX
CONDITION('M')
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
wm_selchange_mytab:
guigetctlvalue("MyTab")
removetabctls()
addtabctls()
myoldtab = mytab
RETURN
removetabctls:
guigetctlvalue(myoldtab)
guiremovectl(myoldtab)
RETURN
addtabctls:
guiaddctl("HTML 9, 76, 538, 228, , CLIENTEDGE, "||mytab||",, ")
RETURN
addnewtab:
tabi = tabname.0 + 1
tabname.0 = tabi
tabvalue = "TAB" || tabi
tabname.tabi = tabvalue
guiaddctltext("MyTab", tabvalue, tabi)
mytab = tabvalue
guisetctlvalue("MyTab")
mytab = tabvalue
tabmax = tabmax + 1
RETURN
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
wm_ok_command:
wm_select_command:
runcommand()
RETURN
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
wm_click_newtab:
addnewtab()
RETURN
wm_click_removetab:
removetab()
RETURN
|