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

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

  
/*
GUIBEGIN
WINDOW , 10, 35, 400, 200, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
	FONT 8, 400, MS Shell Dlg
	MENU
	PUSH 30, 27, 40, 14, TABSTOP, , MyButton, , Push
DEND

MENU
	HEADING File
		ITEM Open
		ITEM Save
		ITEM Exit
	<
DEND
GUIEND
*/

/* An example of adding help support to a window. We have a CHM file (made
 * with Microsoft's HTML Help Workshop program. In this CHM file, we have
 * a separate page for each control and menu item for which we want to display
 * help. The page is named the same as the control/menu's associated REXX
 * variable, plus a .HTM extension. For example, our PUSH control has an
 * associated variable of "MyButton" so its help page is "MyButton.htm".
 * The File -> Open menu item has no associated variable, so its help page
 * is simply "FileOpen.htm".
 *
 * We'll name our help book the same as this REXX Script, with a .CHM extension.
 */

OPTIONS "C_CALL"
NUMERIC DIGITS 10
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1

/* We'll use the HTML control for help display. */
guiwindowdefaults(, , , , "HTML")

guicreatewindow('NORMAL')
again:
DO FOREVER
	guigetmsg()
	CATCH SYNTAX
			CONDITION('M')
			SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN

fileexit:
	guisendmsg(, "POST CLOSE")
	RETURN


/***************** HELP Event Handler ****************
 * This is called by Reginald whenever our window has
 * a HELP event. It is passed the following args:
 *
 * ARG(1) = A 1 if the F1 key was pressed while a control
 *          or the window itself is active. A 0 if F1 was
 *          pressed while the user is highlighting some
 *          menu item.
 * ARG(2) = The name of the object (or main window layout
 *          script) that owns the control or menu item.
 * ARG(3) = The associated variable for the control or
 *	    menu item. If it's a control that doesn't have
 *          an associated variable, or the window itself,
 *          then ARG(3) is the script name. If it's a menu
 *          item that doesn't have an associated variable,
 *          then ARG(3) is the full menu label.
 */

wm_help:
	/* Let's create our URL. To display a page in a .CHM file,
	 * our URL must start with "its:". Then we take our object/script
	 * name, and append ".CHM" to it. Next is two colons, and finally
	 * we append our page name. We assume the page name will be
	 * the associated variable name plus .HTM extension.
	 *
	 * Then we create a HelpBox.rex object which does the actual
	 * display in an HTML control in its own window.
	 */
	createobject("HelpBox.rex", , , "its:" || ARG(2) || ".chm::" || ARG(3) || ".htm")

	/* Note: The Helpbox.rex object is written so that it doesn't return
	 * from CreateObject until the user closes its modal window (or an
	 * error in creating the window).
	 */

	/* Don't let Rexx Gui process this event. */
	RETURN ""
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2024-4-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:49:00