home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vxdemo.zip
/
SYSTEM.$$$
/
MINMAX.VRM
< prev
next >
Wrap
Text File
|
1993-09-01
|
5KB
|
247 lines
/* Custom mainline for macro */
call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
call VRLoadFuncs
_VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
if( _VREVersion < 1.01 )then do
call VRMessage "", "This program requires VX-REXX version 1.01 to run", "Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
signal on SYNTAX name _VRESyntax
signal _VREMain
_VRESyntax:
parse source . . _VRESourceSpec
call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
_VREMain:
/*:VRX Main
*/
/* Main
*/
Main:
/* Process the arguments.
Get the parent window.
*/
parse source . calledAs .
parent = ""
argCount = arg()
argOff = 0
if( calledAs \= "COMMAND" )then do
if argCount >= 1 then do
parent = arg(1)
argCount = argCount - 1
argOff = 1
end
end
InitArgs.0 = argCount
if( argCount > 0 )then do i = 1 to argCount
InitArgs.i = arg( i + argOff )
end
drop calledAs argCount argOff
/* Load the windows
*/
call VRInit
parse source . . spec
_VREPrimaryWindowPath = ,
VRParseFileName( spec, "dpn" ) || ".VRW"
_VREPrimaryWindow = ,
VRLoad( parent, _VREPrimaryWindowPath )
drop parent spec
if( _VREPrimaryWindow == "" )then do
call VRMessage "", "Cannot load window:" VRError(), ,
"Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
/* Process events
*/
call Init
signal on halt
do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
_VREEvent = VREvent()
interpret _VREEvent
end
_VREHalt:
_VREReturnValue = Fini()
call VRDestroy _VREPrimaryWindow
_VRELeaveMain:
call VRFini
exit _VREReturnValue
VRLoadSecondary: procedure
name = arg( 1 )
window = VRLoad( VRWindow(), VRWindowPath(), name )
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
return window
/*:VRX Comments
*/
Comments:
/*
MinMax: Generate a prototype for Min and Max functions
Usage: call MinMax <Parent>, <Function>
Where: Parent is the parent window for the dialog
Function is the function that is using this macro.
*/
return
/*:VRX Error
*/
Error: procedure
field = arg( 1 )
error = arg( 2 )
call VRMessage VRWindow(), error, "Error"
call VRMethod field, "SetFocus"
return
/*:VRX Fini
*/
Fini:
window = VRWindow()
call VRSet window, "Visible", 0
drop window
return Prototype
/*:VRX Halt
*/
Halt:
signal _VREHalt
return
/*:VRX Init
*/
Init:
Prototype = ""
TargetObject = InitArgs.1
argument = InitArgs.2
parse var argument Funcname
call VRSet "Window1", "Caption", funcname
call VRSet "PB_3", "HintText", "Help for the" funcname "function."
window = VRWindow()
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
drop window
return
/*:VRX PB_1_Click
*/
PB_1_Click:
if VRGet( "Values", "Count" ) = 0 then do
call Error "Value", "You must enter at least one value."
return
end
else do
values = ''
do i = 1 to VRGet( "Values", "Count" )
string = VRMethod( "Values", "GetString", i )
if values \= "" then values = values || ', '
values = values || string
end
end
if funcname = "Min" then retval = "min"
if funcname = "Max" then retval = "max"
Prototype = retval ' = ' || Funcname ||,
'( ' || values || ' )'
call Quit
return
/*:VRX PB_2_Click
*/
PB_2_Click:
rc = ""
call Quit
return
/*:VRX PB_3_Click
*/
PB_3_Click:
"view rexx.inf" funcname
return
/*:VRX PB_4_Click
*/
PB_4_Click:
value = VRGet( "Value", "Value" )
ok = VRSet( "Value", "Value", "" )
position = VRMethod( "Values", "AddString", value, )
ok = VRSet( "PB_4", "Enabled", 0 )
ok = VRMethod( "Value", "SetFocus" )
return
/*:VRX PB_5_Click
*/
PB_5_Click:
selected = VRGet( "Values", "Selected" )
ok = VRMethod( "Values", "Delete", selected )
call Values_Click
return
/*:VRX Quit
*/
Quit:
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
return
/*:VRX Value_Change
*/
Value_Change:
if VRGet( "Value", "Value" ) \= "" then do
ok = VRSet( "PB_4", "Enabled", 1 )
end
else do
ok = VRSet( "PB_4", "Enabled", 0 )
end
return
/*:VRX Values_Click
*/
Values_Click:
if VRGet( "Values", "SelectedString" ) \= "" then do
ok = VRSet( "PB_5", "Enabled", 1 )
end
else do
ok = VRSet( "PB_5", "Enabled", 0 )
end
return
/*:VRX Window1_Close
*/
Window1_Close:
rc = ""
call Quit
return