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

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

  
/*
GUIBEGIN
WINDOW , 123, 231, 336, 124, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , Mouse Position example
	FONT 8, 400, MS Shell Dlg
	GROUP 2, 5, 327, 50, GROUP, , , , Image
	RADIO 10, 21, 48, 8, AUTO|GROUP, , MouseShapes, ALT "D", Stan&dard
	RADIO 69, 21, 42, 8, AUTO, , , ALT "I", &I_beam
	RADIO 122, 21, 35, 8, AUTO, , , ALT "A", W&ait
	RADIO 172, 21, 40, 8, AUTO, , , ALT "C", &Cross
	RADIO 218, 21, 48, 8, AUTO, , , ALT "U", &UpArrow
	RADIO 269, 21, 56, 8, AUTO, , , ALT "S", SizeNW&SE
	RADIO 10, 36, 55, 8, AUTO, , , ALT "E", SizeN&ESW
	RADIO 70, 36, 46, 8, AUTO, , , ALT "W", Size&WE
	RADIO 121, 36, 42, 10, AUTO, , , ALT "N", Size&NS
	RADIO 172, 36, 39, 10, AUTO, , , ALT "L", SizeA&ll
	RADIO 218, 36, 32, 8, AUTO, , , ALT "O", N&o
	RADIO 269, 36, 46, 10, AUTO, , , ALT "P", A&ppStart
	TEXT 97, 72, 125, 8, GROUP, , , , Move mouse here to observe shape
DEND
GUIEND

*/

/* An example of printing the mouse coordinates when the mouse
 * is moved inside of a REXX GUI window.
 */

/* ============== FUNCDEF some needed OS functions ============ */
LIBRARY rexxgui
DO
	/* FUNCDEF LoadCursor. It loads a cursor image from the
	 * resource of some executable, or uses one of the standard
	 * windows cursors such as a wait pointer. We're going to
	 * define it (callable as LoadStdCursor) for doing the latter
	 * easily
	 */
	FUNCDEF("LoadStdCursor", "void, void, 32u", "user32", "LoadCursor")

	/* FUNCDEF SetCursor. It sets the mouse pointer image */
	FUNCDEF("SetCursor", "void, void", "user32")

	CATCH FAILURE
		CONDITION("M")
		RETURN
END

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

/* Initially assume a standard mouse pointer */
imagenumber = 32512

presets.1 = 32512
presets.2 = 32513
presets.3 = 32514
presets.4 = 32515
presets.5 = 32516
presets.6 = 32642
presets.7 = 32643
presets.8 = 32644
presets.9 = 32645
presets.10 = 32646
presets.11 = 32648
presets.12 = 32650

again:
DO FOREVER

	guigetmsg()

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

/* ================== WM_MOUSEMOVE ==================
 * This handles the MOUSEMOVE event for my window.
 *
 * Reginald calls this when the user has moved
 * the mouse pointer.
 *
 * ARG(1) is a value that tells what keys (on the keyboard)
 * were held down while the mouse was moved.
 * ARG(2) is the X position of the mouse.
 * ARG(3) is the Y position of the mouse.
 */

wm_mousemove:

	/* Let's get the mouse image shape desired. If you use the
	 * PROCEDURE keyword, remember to EXPOSE external variables
	 * you wish to access here.
	 */

	/* The first arg to LoadStdCursor can be omitted.
	 *
	 * The second arg determines which preset image is
	 * used, and must be one of the following:
	 * 
	 * Standard ARROW = 32512
	 * IBEAM = 32513
	 * WAIT = 32514
	 * CROSS = 32515
	 * UPARROW = 32516
	 * SIZENWSE = 32642
	 * SIZENESW = 32643
	 * SIZEWE = 32644
	 * SIZENS = 32645
	 * SIZEALL = 32646
	 * NO = 32648
	 * APPSTARTING = 32650
	 */
	newcursor = loadstdcursor(, imagenumber)

	/* Did we get it ok? */
	IF newcursor \== 0 THEN

	  /* Change the mouse to that image */
	  setcursor(newcursor)

	/* We handled this msg */
	RETURN ""


/* =============== WM_CLICK_MouseShapes ===============
 * This handles the CLICK event for my group of RADIO
 * buttons associated with the "MouseShapes" variable.
 *
 * Reginald calls this when the user has changed to
 * a different radio button.
 */

wm_click_mouseshapes:
	/* Get the currently selected button number. */
	guigetctlvalue("MouseShapes")

	IF EXISTS("MouseShapes") THEN

	/* Look up the value that we'll pass to LoadStdCursor for
	 * this mouse pointer, and set "ImageNumber" to it.
	 */
	imagenumber = presets.mouseshapes

	RETURN
掌柜推荐
 
 
¥900.00 ·
 
 
¥880.00 ·
 
 
¥497.00 ·
 
 
¥380.00 ·
 
 
¥980.00 ·
 
 
¥1,080.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:10