home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrprt21.zip / VRPrTbl.VRM < prev    next >
Text File  |  1995-10-15  |  4KB  |  168 lines

  1. /* Custom mainline for macro */
  2.  
  3.     signal on SYNTAX name _VRESyntax
  4.     signal _VREMain
  5.  
  6. _VRESyntax:
  7.     parse source . . _VRESourceSpec
  8.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!"
  9.     call VRFini
  10.     exit 32000
  11.  
  12. _VREMain:
  13. /*:VRX         Main
  14. */
  15. /*  Main
  16. */
  17. Main:
  18. /*  Process the arguments.
  19.     Get the parent window.
  20. */
  21.     parse source . calledAs .
  22.     parent = ""
  23.     argCount = arg()
  24.     argOff = 0
  25.     if( calledAs \= "COMMAND" )then do
  26.         if argCount >= 1 then do
  27.             parent = arg(1)
  28.             argCount = argCount - 1
  29.             argOff = 1
  30.         end
  31.     end; else do
  32.         call VROptions 'ImplicitNames'
  33.     end
  34.     InitArgs.0 = argCount
  35.     if( argCount > 0 )then do i = 1 to argCount
  36.         InitArgs.i = arg( i + argOff )
  37.     end
  38.     drop calledAs argCount argOff
  39.  
  40. /*  Load the windows
  41. */
  42.     call VRInit
  43.     parse source . . spec
  44.     _VREPrimaryWindowPath = ,
  45.         VRParseFileName( spec, "dpn" ) || ".VRW"
  46.     _VREPrimaryWindow = ,
  47.         VRLoad( parent, _VREPrimaryWindowPath )
  48.     drop parent spec
  49.     if( _VREPrimaryWindow == "" )then do
  50.         call VRMessage "", "Cannot load window:" VRError(), ,
  51.             "Error!"
  52.         _VREReturnValue = 32000
  53.         signal _VRELeaveMain
  54.     end
  55.  
  56. /*  Process events
  57. */
  58.     call Init
  59.     signal on halt
  60.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  61.         _VREEvent = VREvent()
  62.         interpret _VREEvent
  63.     end
  64. _VREHalt:
  65.     _VREReturnValue = Fini()
  66.     call VRDestroy _VREPrimaryWindow
  67. _VRELeaveMain:
  68.     call VRFini
  69. exit _VREReturnValue
  70.  
  71. VRLoadSecondary:
  72.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  73.     if __vrlsWait then do
  74.         call VRFlush
  75.     end
  76.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  77.     if __vrlsHWnd = '' then signal __vrlsDone
  78.     if __vrlsWait \= 1 then signal __vrlsDone
  79.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  80.     __vrlsTmp = __vrlsWindows.0
  81.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  82.         __vrlsTmp = 1
  83.     end
  84.     else do
  85.         __vrlsTmp = __vrlsTmp + 1
  86.     end
  87.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  88.     __vrlsWindows.0 = __vrlsTmp
  89.     do while( VRIsValidObject( VRWindow() ) = 1 )
  90.         __vrlsEvent = VREvent()
  91.         interpret __vrlsEvent
  92.     end
  93.     __vrlsTmp = __vrlsWindows.0
  94.     __vrlsWindows.0 = __vrlsTmp - 1
  95.     call VRWindow __vrlsWindows.__vrlsTmp 
  96.     __vrlsHWnd = ''
  97. __vrlsDone:
  98. return __vrlsHWnd
  99.  
  100. /*:VRX         dlg_Close
  101. */
  102. dlg_Close:
  103.     call Quit
  104. return
  105.  
  106. /*:VRX         Fini
  107. */
  108. Fini:
  109.     window = VRWindow()
  110.     call VRSet window, "Visible", 0
  111.     drop window
  112. return ret
  113.  
  114. /*:VRX         Halt
  115. */
  116. Halt:
  117.     signal _VREHalt
  118. return
  119.  
  120. /*:VRX         Init
  121. */
  122. Init:
  123.  
  124.     ret = '';
  125.  
  126.     if InitArgs.0 < 2 then
  127.         call Quit;
  128.  
  129.     object = InitArgs.1;
  130.     method = InitArgs.2;
  131.  
  132.     window = VRWindow()
  133.     ok = VRSet( window, "Caption", method )
  134.     call VRMethod window, "CenterWindow"
  135.     call VRSet window, "Visible", 1
  136.     call VRMethod window, "Activate"
  137.     drop window
  138.  
  139. return
  140.  
  141. /*:VRX         PB_accept_Click
  142. */
  143. PB_accept_Click: 
  144.     left = VRGet( "SPIN_left", "Value");
  145.     cols = VRGet( "SPIN_cols", "Value");
  146.     fill = VRGet( "SPIN_fill", "Value");
  147.     line = VRGet( "SPIN_line", "Value");
  148.     widths = VRGet( "EF_widths", "Value");
  149.     ret = 'ok = VRMethod( "' || object ||'", "' || method || '",' fill',' line',' cols',' left',' widths');'
  150.     call Quit
  151. return
  152.  
  153. /*:VRX         PB_Cancel_Click
  154. */
  155. PB_Cancel_Click: 
  156.     ret = '';
  157.     call Quit;
  158. return
  159.  
  160. /*:VRX         Quit
  161. */
  162. Quit:
  163.     window = VRWindow()
  164.     call VRSet window, "Shutdown", 1
  165.     drop window
  166. return
  167.  
  168.