home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / SYSTEM.$$$ / VRDIR.VRM < prev    next >
Text File  |  1993-09-01  |  5KB  |  202 lines

  1. /* Custom mainline for macro */
  2.  
  3.     call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
  4.     call VRLoadFuncs
  5.  
  6.     _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
  7.     if( _VREVersion < 1.01 )then do
  8.         call VRMessage "", "This program requires VX-REXX version 1.01 to run", "Error!"
  9.         _VREReturnValue = 32000
  10.         signal _VRELeaveMain
  11.     end
  12.  
  13.     signal on SYNTAX name _VRESyntax
  14.     signal _VREMain
  15.  
  16. _VRESyntax:
  17.     parse source . . _VRESourceSpec
  18.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
  19.     _VREReturnValue = 32000
  20.     signal _VRELeaveMain
  21.  
  22. _VREMain:
  23. /*:VRX         Main
  24. */
  25. /*  Main
  26. */
  27. Main:
  28. /*  Process the arguments.
  29.     Get the parent window.
  30. */
  31.     parse source . calledAs .
  32.     parent = ""
  33.     argCount = arg()
  34.     argOff = 0
  35.     if( calledAs \= "COMMAND" )then do
  36.         if argCount >= 1 then do
  37.             parent = arg(1)
  38.             argCount = argCount - 1
  39.             argOff = 1
  40.         end
  41.     end
  42.     InitArgs.0 = argCount
  43.     if( argCount > 0 )then do i = 1 to argCount
  44.         InitArgs.i = arg( i + argOff )
  45.     end
  46.     drop calledAs argCount argOff
  47.  
  48. /*  Load the windows
  49. */
  50.     call VRInit
  51.     parse source . . spec
  52.     _VREPrimaryWindowPath = ,
  53.         VRParseFileName( spec, "dpn" ) || ".VRW"
  54.     _VREPrimaryWindow = ,
  55.         VRLoad( parent, _VREPrimaryWindowPath )
  56.     drop parent spec
  57.     if( _VREPrimaryWindow == "" )then do
  58.         call VRMessage "", "Cannot load window:" VRError(), ,
  59.             "Error!"
  60.         _VREReturnValue = 32000
  61.         signal _VRELeaveMain
  62.     end
  63.  
  64. /*  Process events
  65. */
  66.     call Init
  67.     signal on halt
  68.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  69.         _VREEvent = VREvent()
  70.         interpret _VREEvent
  71.     end
  72. _VREHalt:
  73.     _VREReturnValue = Fini()
  74.     call VRDestroy _VREPrimaryWindow
  75. _VRELeaveMain:
  76.     call VRFini
  77. exit _VREReturnValue
  78.  
  79. VRLoadSecondary: procedure
  80.     name = arg( 1 )
  81.  
  82.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  83.     call VRMethod window, "CenterWindow"
  84.     call VRSet window, "Visible", 1
  85.     call VRMethod window, "Activate"
  86. return window
  87.  
  88. /*:VRX         Comments
  89. */
  90. Comments:
  91. /*  
  92.     VRDir: Generate a prototype for the VRDir function
  93.  
  94.     Usage:  call VRDir <Parent>
  95.  
  96.     Where:  Parent is the parent window for the dialog
  97.         
  98. */
  99. return
  100.  
  101. /*:VRX         Error
  102. */
  103. Error: procedure
  104.     field = arg( 1 )
  105.     error = arg( 2 )
  106.     call VRMessage VRWindow(), error, "Error"
  107.     call VRMethod field, "SetFocus"
  108. return
  109.  
  110. /*:VRX         Fini
  111. */
  112. Fini:
  113.     window = VRWindow()
  114.     call VRSet window, "Visible", 0
  115.     drop window
  116. return Prototype
  117.  
  118. /*:VRX         Halt
  119. */
  120. Halt:
  121.     signal _VREHalt
  122. return
  123.  
  124. /*:VRX         Init
  125. */
  126. Init:
  127.  
  128.     Prototype = ""
  129.  
  130.     window = VRWindow()
  131.     call VRMethod window, "CenterWindow"
  132.     call VRSet window, "Visible", 1
  133.     call VRMethod window, "Activate"
  134.     drop window
  135. return
  136.  
  137. /*:VRX         PB_1_Click
  138. */
  139. PB_1_Click:
  140.     file = VRGet( 'File', 'Value' )
  141.     if VRGet( "Quotes", "Set" ) & file \= "" then do
  142.         file = '"' || file || '"'
  143.     end
  144.  
  145.     output = ""
  146.     if VRGet( "Name", "Set" ) then output = output || "N"
  147.     if VRGet( "Size", "Set" ) then output = output || "S"
  148.     if VRGet( "Date", "Set" ) then output = output || "D"
  149.     if VRGet( "Time", "Set" ) then output = output || "T"
  150.     if VRGet( "Attributes", "Set" ) then output = output || "A"
  151.     if output \= "" then output = '"' || output || '"'
  152.  
  153.     include = ""
  154.     if VRGet( "Directory", "Set" ) then include = include || "D"
  155.     if VRGet( "Hidden", "Set" ) then include = include || "H"
  156.     if VRGet( "System", "Set" ) then include = include || "S"
  157.     if include \= "" then include = '"' || include || '"'
  158.  
  159.     setoff = ""
  160.     if VRGet( "ArchiveOff", "Set" ) then setoff = setoff || "A"
  161.     if VRGet( "ReadonlyOff", "Set" ) then setoff = setoff || "R"
  162.     if VRGet( "DirectoryOff", "Set" ) then setoff = setoff || "D"
  163.     if VRGet( "HiddenOff", "Set" ) then setoff = setoff || "H"
  164.     if VRGet( "SystemOff", "Set" ) then setoff = setoff || "S"
  165.     if setoff \= "" then setoff = '"' || setoff || '"'
  166.  
  167.     Prototype = 'fileinfo = VRDir(' file  || ',' output ||,
  168.                             ',' include || ',' setoff ')'
  169.  
  170.     call Quit
  171.  
  172. return
  173.  
  174. /*:VRX         PB_2_Click
  175. */
  176. PB_2_Click:
  177.     rc = ""
  178.     call Quit
  179. return
  180.  
  181. /*:VRX         PB_3_Click
  182. */
  183. PB_3_Click:
  184.     "view a2z.inf VRDir function"
  185. return
  186.  
  187. /*:VRX         Quit
  188. */
  189. Quit:
  190.     window = VRWindow()
  191.     call VRSet window, "Shutdown", 1
  192.     drop window
  193. return
  194.  
  195. /*:VRX         Window1_Close
  196. */
  197. Window1_Close:
  198.     rc = ""
  199.     call Quit
  200. return
  201.  
  202.