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
END
CATCH SYNTAX
CONDITION()
SIGNAL again
CATCH HALT
FINALLY
guidestroywindow()
END
RETURN
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 ""
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 )
wdw_size.max_y = getsystemmetrics(62 )
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_wsize_variable:
guigetctlplacement(, 'dummy1', 'dummy2', 'wdw_width', 'wdw_height')
x_min = wdw_width ; y_min = 400
x_max = wdw_width ; y_max = 1000
RETURN 0 |