Guidance
指路人
g.yi.org
Software / Reginald / Examples / browser.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/*
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
掌柜推荐
 
 
¥420.00 ·
 
 
¥470.00 ·
 
 
¥890.00 ·
 
 
¥660.00 ·
 
 
¥748.00 ·
 
 
¥1,800.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:45:33