home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vxdemo.zip
/
SYSTEM.$$$
/
VRFILEDI.VRM
< prev
next >
Wrap
Text File
|
1993-09-01
|
7KB
|
267 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:
/*
VRFileDi: Generate a prototype for the VRFileDialog function
Usage: call VRFileDi <Parent>
Where: Parent is the parent window for the dialog
*/
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 = ""
call VRSet "DType", "Value", "Open"
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:
parent = 'VRWindow()'
title = VRGet( "Title", "Value" )
if VRGet( "Quotes1", "Set" ) then do
title = '"' || title || '"'
end
dtype = '"' || VRGet( "DType", "Value" ) || '"'
ipath = VRGet( "IPath", "Value" )
if VRGet( "Quotes2", "Set" ) & ipath \= "" then do
ipath = '"' || ipath || '"'
end
itype = VRGet( "IType", "Value" )
if VRGet( "Quotes3", "Set" ) & itype \= "" then do
itype = '"' || itype || '"'
end
drives = ""
gdrivelist = VRGet( "Quotes4", "Set" )
if gdrivelist then do
drivelist = VRGet( "Drivelist", "Value" )
sepchar = Left( drivelist, 1 )
i = 0
interpret "parse var drivelist '" || sepchar || "' drivelist"
do while drivelist \= ""
interpret "parse var drivelist item '" || sepchar || "' drivelist"
if item \= "" then do
if length( item ) \= 2 | lastpos( ":", item ) \= 2 then do
call Error "Drive list", "Each item in the Drive list must be a drive letter followed by a colon."
Prototype = ""
return
end
i = i + 1
Prototype = Prototype || 'Drives.' || i ||,
' = "' || item || '"' || "0d0a"x
end
end
if i > 0 then do
Prototype = Prototype || "Drives.0 = " ||,
i || '0d0a'x || '0d0a'x
drives = '"Drives."'
end
end
else do
drivelist = VRGet( "Drivelist", "Value" )
if drivelist \= "" then do
if Lastpos( ".", drivelist ) \= length( drivelist ) then do
call Error "Drive list", "The drive list must be a stem variable, followed by a period."
return
end
end
drives = '"' || drivelist || '"'
end
types = ""
gtypelist = VRGet( "Quotes5", "Set" )
if gtypelist then do
typelist = VRGet( "Typelist", "Value" )
sepchar = Left( typelist, 1 )
i = 0
interpret "parse var typelist '" || sepchar || "' typelist"
do while typelist \= ""
interpret "parse var typelist item '" || sepchar || "' typelist"
if item \= "" then do
i = i + 1
Prototype = Prototype || 'Types.' || i ||,
' = "' || item || '"' || "0d0a"x
end
end
if i > 0 then do
Prototype = Prototype || "Types.0 = " ||,
i || '0d0a'x || '0d0a'x
types = '"Types."'
end
end
else do
typelist = VRGet( "Typelist", "Value" )
if typelist \= "" then do
if Lastpos( ".", typelist ) \= length( typelist ) then do
call Error "Type list", "The type list must be a stem variable, followed by a period."
return
end
end
types = '"' || typelist || '"'
end
Prototype = Prototype || 'FileName = VRFileDialog( ' || parent ||,
', ' || title || ', ' || dtype ||,
', ' || ipath || ', ' || itype ||,
', ' || drives || ', ' || types || ' )'
call Quit
return
/*:VRX PB_2_Click
*/
PB_2_Click:
rc = ""
call Quit
return
/*:VRX PB_3_Click
*/
PB_3_Click:
"view a2z.inf VRFileDialog function"
return
/*:VRX Quit
*/
Quit:
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
return
/*:VRX Window1_Close
*/
Window1_Close:
rc = ""
call Quit
return