home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrxda.zip / meth2p.VRM < prev    next >
Text File  |  1995-08-21  |  4KB  |  177 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.     parse var InitArgs.2 method'_'var1'_'var2'_'retname
  131.  
  132.     window = VRWindow()
  133.     call VRSet "DT_1", "Caption", var1
  134.     call VRSet "DT_2", "Caption", var2
  135.     ok = VRSet( window, "Caption", method )
  136.     call VRMethod window, "CenterWindow"
  137.     call VRSet window, "Visible", 1
  138.     call VRMethod window, "Activate"
  139.     drop window
  140.  
  141.     ok = VRMethod( "EF_Value1", "SetFocus" )
  142.     
  143. return
  144.  
  145. /*:VRX         PB_accept_Click
  146. */
  147. PB_accept_Click: 
  148.     value1 = VRGet( "EF_Value1", "Value" )
  149.     set = VRGet( "CB_1", "Set" )
  150.     if set then
  151.         value1 = '"' || value1 || '"'
  152.  
  153.     value2 = VRGet( "EF_Value2", "Value" )
  154.     set = VRGet( "CB_2", "Set" )
  155.     if set then
  156.         value2 = '"' || value2 || '"'
  157.  
  158.     ret = retname '= VRMethod( "' || object ||'", "' || method || '",' value1 || ',' value2 || ");"
  159.     call Quit
  160. return
  161.  
  162. /*:VRX         PB_Cancel_Click
  163. */
  164. PB_Cancel_Click: 
  165.     ret = '';
  166.     call Quit;
  167. return
  168.  
  169. /*:VRX         Quit
  170. */
  171. Quit:
  172.     window = VRWindow()
  173.     call VRSet window, "Shutdown", 1
  174.     drop window
  175. return
  176.  
  177.