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

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

  
/*
GUIBEGIN
WINDOW , 31, 131, 227, 63, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , CTLCOLOREDIT example
	FONT 8, 400, MS Shell Dlg
	ENTRY 41, 11, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry1
	ENTRY 150, 11, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry2
	ENTRY 41, 29, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry3
	ENTRY 150, 30, 64, 12, H_AUTO|BORDER|TABSTOP, , Entry4
	TEXT 14, 13, 26, 8, GROUP, , , , Entry 1
	TEXT 122, 13, 26, 8, GROUP, , , , Entry 2
	TEXT 122, 32, 26, 8, GROUP, , , , Entry 4
	TEXT 13, 31, 26, 8, GROUP, , , , Entry 3
DEND
GUIEND
*/

/*
 * An example of handling the CTLCOLOREDIT event of a
 * REXX GUI window to set the color of ENTRY controls.
 *
 * In this example, we'll change the color of ENTRY controls in
 * window. This will be almost the same as colors.rex (which
 * handled the CTLCOLORSTATIC event) but here we're going to do
 * one other thing. Instead of changing the colors of all entry
 * boxes, we're going to change only one specific entry box. To
 * do this, you'll see how you can use the window handle arg to
 * our WM_CTLCOLOREDIT to determine the correct control.
 */

OPTIONS "C_CALL LABELCHECK WINFUNC NOSOURCE"
LIBRARY rexxgui

DO
	/* Register GetStockObject so we can grab one of the preset brushes for drawing text. */
	FUNCDEF("GetStockObject", "void, 32u", "gdi32")

	/* Register SetBkColor so we can change the background color for text. */
	FUNCDEF("SetBkColor", "32u, void, 32u", "gdi32")

	/* Register SetTextColor so we can change the foreground color for text. */
	FUNCDEF("SetTextColor", "32u, void, 32u", "gdi32")

	CATCH FAILURE
		CONDITION("M")
		RETURN
END

/* Initialize the contents of our ENTRY controls. */
entry1 = "something"
entry2 = "something"
entry3 = "something"
entry4 = "something"

guierr = "SYNTAX"
guiheading = 1
guicreatewindow('NORMAL')

/* We want to change the color of only "Entry2". Let's
 * get its window handle by calling GuiQuery().
 */
entry2handle = guiinfo("HANDLE", "Entry2")

again:
DO FOREVER

	guigetmsg()

	CATCH SYNTAX
		CONDITION('M')
		SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN

/* ================== WM_CTLCOLOREDIT ==================
 * This handles the CTLCOLOREDIT event for my window.
 *
 * This event happens when REXX GUI wants us to return
 * a "brush" used for drawing ENTRY controls.
 *
 * ARG(1) is our device context handle.
 * ARG(2) is the handle to the entry control (window).
 *
 * CTLCOLOREDIT works the same as CTLCOLORSTATIC, so
 * see the comments in colors.rex.
 */

wm_ctlcoloredit: PROCEDURE EXPOSE entry2handle

	/* Is this the second entry? If so, return a new
	 * color. If not, then do the default handling instead.
	 */
	IF entry2handle = ARG(2) THEN DO

		/* Now return the new color. */
		settextcolor(ARG(1), 255 * 256)
		setbkcolor(ARG(1), 255)
		RETURN getstockobject(5)

	END

	/* It is some other ENTRY. Let Rexx Gui process this event. */
	RETURN
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:34:56