Guidance
指路人
g.yi.org
Upload / Forum Attachment / Reginald Rexx Programming Language Compiler User Forum Attachments and Pictures / 13296-window_example.rex

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

  
/*
GUIBEGIN


WINDOW , 0, 0, 291, 91, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , My Window
	FONT 8, 400, MS Shell Dlg
	PUSH 93, 36, 126, 14, TABSTOP, , dummy_button, , Dummy
DEND
GUIEND
*/

/* Load Rexx Gui functions. */
LIBRARY rexxgui
guierr = "SYNTAX"
guiheading = 1
rc = pre_create_window()
guicreatewindow()
rc = post_create_window()
guisetctlvalue()
guisetctlplacement(,,,,,,'AMAX')
again:
DO FOREVER
	guigetmsg()
	IF EXISTS('GuiObject') == 0 THEN DO
		IF EXISTS('GuiSignal') THEN DO
		END
	END
	ELSE DO
		IF EXISTS('GuiSignal') == 0 THEN DROP (guiobject)
		ELSE SELECT guiobject
			WHEN 0 THEN NOP
			OTHERWISE
		END /* SELECT GuiObject */
	END /* Some child script signaled us */
	CATCH SYNTAX
			CONDITION()
			SIGNAL again
	CATCH HALT
	FINALLY
		guidestroywindow()
END
RETURN
/*********************************************************
 Let's resize                                             
*********************************************************/
wm_size:
SELECT
	WHEN EXISTS("wdw_size.0") THEN
		DO
			window_size = SUBWORD(window_size, 3, 2) ARG(3) ARG(4)
			DO
				rc = test_wm_size.rex() 
				CATCH user any
					temp = CONDITION('D')
					PARSE VAR temp 'failed at line' . ':' reason
					temp = '*** Invalid syntax for resizing ' || '0A0D'x,
								 reason || '0A0D'x,
								 'Correct your program and try again'
					rc = wdwsay.rex(temp, 'STOP')
				CATCH ERROR
					temp = CONDITION('D')
					PARSE VAR temp 'failed at line' . ':' reason
					rc = wdwsay.rex(reason, 'STOP')										
			END
		END
	WHEN ARG(4) = 0 THEN
		NOP
	OTHERWISE
		window_size = 0 0 ARG(3) ARG(4)
END
RETURN ""
/********************************************************

********************************************************/
wm_getminmaxinfo:
rc = EXISTS("wdw_size.0")
IF rc = 0 THEN
	RETURN ""
CONVERTDATA(ARG(2), "MinMax", "struct MINMAXINFO")
minmax.7 =  x_min
minmax.8 =  y_min 
IF x_max <> 0 & y_max <> 0 THEN
	DO
    minmax.9 = x_max
    minmax.10 = y_max
	END
CONVERTDATA(ARG(2), "MinMax", "struct MINMAXINFO", 'FROM')
RETURN ""	
/************************************************************
Set up the variable wdw_size. that will tell 
resize_gui_wdw_exact what we want done with the controls as
and when we resize them
************************************************************/
get_control_size_pos:

i = 1	
wdw_size.i = ' dummy_button M 0 0' ; i = i + 1
wdw_size.0 = i - 1

DO i = 1 TO wdw_size.0
  PARSE VAR wdw_size.i next_ctrl rest 
  handle = guiinfo("HANDLE", next_ctrl)
  guigetctlplacement(next_ctrl, "x_pos", "y_pos", "x_width", "y_height")
  wdw_size.i = next_ctrl handle x_pos y_pos x_width y_height rest 
  CATCH SYNTAX
    err = CONDITION("D")
    rc = wdwsay.rex("Control "next_ctrl" failed with "err, 'STOP')
END

FUNCDEF('GetSystemMetrics', '32u, 32u', 'user32')
wdw_size.max_x = getsystemmetrics(61 /* SM_CXMAXIMIZED */)
wdw_size.max_y = getsystemmetrics(62 /* SM_CYMAXIMIZED */)

RETURN 0
pre_create_window:
FUNCDEF("MINMAXINFO", "32,32,32,32,32,32,32,32,32,32")
RETURN 0
post_create_window:
rc = get_control_size_pos()
rc = set_wsize_variable()	
RETURN 0
/*******************************************************
 Set the values in wsize, min/max values.
 wsize.1 and wsize.2 are the min X/Y sizes we allow the
     window to be reduced to
 wsize.3 and wsize.4 are the max X/Y sizes we allow the
     window to be increased to     
*******************************************************/
set_wsize_variable:
guigetctlplacement(, 'dummy1', 'dummy2', 'wdw_width', 'wdw_height')
/* Don't allow them to reduce size below these X/Y sizes */
x_min = wdw_width ; y_min = 400
/* .... or these max sizes */
x_max = wdw_width ; y_max = 1000
RETURN 0
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-5-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-03-30 18:07:11