home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrxda12.zip / METH1P.VRM < prev    next >
Text File  |  1995-08-21  |  4KB  |  182 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 < 2.13 )then do
  8.         call VRMessage "", "This program requires VX-REXX version 2.1c to run.", "Error!"
  9.         return 32000
  10.     end
  11.  
  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":" ErrorText(rc), "Error!"
  19.     call VRFini
  20.     exit 32000
  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; else do
  42.         call VROptions 'ImplicitNames'
  43.     end
  44.     InitArgs.0 = argCount
  45.     if( argCount > 0 )then do i = 1 to argCount
  46.         InitArgs.i = arg( i + argOff )
  47.     end
  48.     drop calledAs argCount argOff
  49.  
  50. /*  Load the windows
  51. */
  52.     call VRInit
  53.     parse source . . spec
  54.     _VREPrimaryWindowPath = ,
  55.         VRParseFileName( spec, "dpn" ) || ".VRW"
  56.     _VREPrimaryWindow = ,
  57.         VRLoad( parent, _VREPrimaryWindowPath )
  58.     drop parent spec
  59.     if( _VREPrimaryWindow == "" )then do
  60.         call VRMessage "", "Cannot load window:" VRError(), ,
  61.             "Error!"
  62.         _VREReturnValue = 32000
  63.         signal _VRELeaveMain
  64.     end
  65.  
  66. /*  Process events
  67. */
  68.     call Init
  69.     signal on halt
  70.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  71.         _VREEvent = VREvent()
  72.         interpret _VREEvent
  73.     end
  74. _VREHalt:
  75.     _VREReturnValue = Fini()
  76.     call VRDestroy _VREPrimaryWindow
  77. _VRELeaveMain:
  78.     call VRFini
  79. exit _VREReturnValue
  80.  
  81. VRLoadSecondary:
  82.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  83.     if __vrlsWait then do
  84.         call VRFlush
  85.     end
  86.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  87.     if __vrlsHWnd = '' then signal __vrlsDone
  88.     if __vrlsWait \= 1 then signal __vrlsDone
  89.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  90.     __vrlsTmp = __vrlsWindows.0
  91.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  92.         __vrlsTmp = 1
  93.     end
  94.     else do
  95.         __vrlsTmp = __vrlsTmp + 1
  96.     end
  97.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  98.     __vrlsWindows.0 = __vrlsTmp
  99.     do while( VRIsValidObject( VRWindow() ) = 1 )
  100.         __vrlsEvent = VREvent()
  101.         interpret __vrlsEvent
  102.     end
  103.     __vrlsTmp = __vrlsWindows.0
  104.     __vrlsWindows.0 = __vrlsTmp - 1
  105.     call VRWindow __vrlsWindows.__vrlsTmp 
  106.     __vrlsHWnd = ''
  107. __vrlsDone:
  108. return __vrlsHWnd
  109.  
  110. /*:VRX         dlg_Close
  111. */
  112. dlg_Close:
  113.     call Quit
  114. return
  115.  
  116. /*:VRX         Fini
  117. */
  118. Fini:
  119.     window = VRWindow()
  120.     call VRSet window, "Visible", 0
  121.     drop window
  122. return ret
  123.  
  124. /*:VRX         Halt
  125. */
  126. Halt:
  127.     signal _VREHalt
  128. return
  129.  
  130. /*:VRX         Init
  131. */
  132. Init:
  133.  
  134.     ret = '';
  135.  
  136.     if InitArgs.0 < 2 then
  137.         call Quit;
  138.  
  139.     object = InitArgs.1;
  140.     parse var InitArgs.2 method'_'var1'_'retname
  141.  
  142.     window = VRWindow()
  143.     call VRSet "DT_1", "Caption", var1
  144.     ok = VRSet( window, "Caption", method )
  145.     call VRMethod window, "CenterWindow"
  146.     call VRSet window, "Visible", 1
  147.     call VRMethod window, "Activate"
  148.     drop window
  149.  
  150.     ok = VRMethod( "EF_Value", "SetFocus" )
  151.     
  152. return
  153.  
  154. /*:VRX         PB_accept_Click
  155. */
  156. PB_accept_Click: 
  157.     value = VRGet( "EF_Value", "Value" )
  158.     set = VRGet( "CB_1", "Set" )
  159.     
  160.     if set then
  161.         value = '"' || value || '"'
  162.  
  163.     ret = retname '= VRMethod( "' || object ||'", "' || method || '",' value || ");"
  164.     call Quit
  165. return
  166.  
  167. /*:VRX         PB_Cancel_Click
  168. */
  169. PB_Cancel_Click: 
  170.     ret = '';
  171.     call Quit;
  172. return
  173.  
  174. /*:VRX         Quit
  175. */
  176. Quit:
  177.     window = VRWindow()
  178.     call VRSet window, "Shutdown", 1
  179.     drop window
  180. return
  181.  
  182.