home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrxda.zip / DASndDta.VRM < prev    next >
Text File  |  1995-08-21  |  4KB  |  179 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.         call VROptions 'NoEchoQuit'
  34.     end
  35.     InitArgs.0 = argCount
  36.     if( argCount > 0 )then do i = 1 to argCount
  37.         InitArgs.i = arg( i + argOff )
  38.     end
  39.     drop calledAs argCount argOff
  40.  
  41. /*  Load the windows
  42. */
  43.     call VRInit
  44.     parse source . . spec
  45.     _VREPrimaryWindowPath = ,
  46.         VRParseFileName( spec, "dpn" ) || ".VRW"
  47.     _VREPrimaryWindow = ,
  48.         VRLoad( parent, _VREPrimaryWindowPath )
  49.     drop parent spec
  50.     if( _VREPrimaryWindow == "" )then do
  51.         call VRMessage "", "Cannot load window:" VRError(), ,
  52.             "Error!"
  53.         _VREReturnValue = 32000
  54.         signal _VRELeaveMain
  55.     end
  56.  
  57. /*  Process events
  58. */
  59.     call Init
  60.     signal on halt
  61.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  62.         _VREEvent = VREvent()
  63.         interpret _VREEvent
  64.     end
  65. _VREHalt:
  66.     _VREReturnValue = Fini()
  67.     call VRDestroy _VREPrimaryWindow
  68. _VRELeaveMain:
  69.     call VRFini
  70. exit _VREReturnValue
  71.  
  72. VRLoadSecondary:
  73.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  74.     if __vrlsWait then do
  75.         call VRFlush
  76.     end
  77.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  78.     if __vrlsHWnd = '' then signal __vrlsDone
  79.     if __vrlsWait \= 1 then signal __vrlsDone
  80.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  81.     __vrlsTmp = __vrlsWindows.0
  82.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  83.         __vrlsTmp = 1
  84.     end
  85.     else do
  86.         __vrlsTmp = __vrlsTmp + 1
  87.     end
  88.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  89.     __vrlsWindows.0 = __vrlsTmp
  90.     do while( VRIsValidObject( VRWindow() ) = 1 )
  91.         __vrlsEvent = VREvent()
  92.         interpret __vrlsEvent
  93.     end
  94.     __vrlsTmp = __vrlsWindows.0
  95.     __vrlsWindows.0 = __vrlsTmp - 1
  96.     call VRWindow __vrlsWindows.__vrlsTmp 
  97.     __vrlsHWnd = ''
  98. __vrlsDone:
  99. return __vrlsHWnd
  100.  
  101. /*:VRX         DASndDta_Close
  102. */
  103. DASndDta_Close:
  104.     call Quit
  105. return
  106.  
  107. /*:VRX         Fini
  108. */
  109. Fini:
  110.     window = VRWindow()
  111.     call VRSet window, "Visible", 0
  112.     drop window
  113. return ret
  114.  
  115. /*:VRX         Halt
  116. */
  117. Halt:
  118.     signal _VREHalt
  119. return
  120.  
  121. /*:VRX         Init
  122. */
  123. Init:
  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.     ok = VRMethod( "EF_Cmd", "SetFocus" )
  140.     
  141. return
  142.  
  143. /*:VRX         PB_Accept_Click
  144. */
  145. PB_Accept_Click: 
  146.     cmd = VRGet( "EF_Cmd", "Value" )
  147.     if VRGet( "CB_1", "Set" ) then
  148.         cmd = '"' || cmd || '"';
  149.  
  150.     data = VRGet( "EF_Data", "Value" )
  151.     if VRGet( "CB_2", "Set" ) then
  152.         data = '"' || data || '"';
  153.  
  154.     respID = VRGet( "EF_respid", "Value" )
  155.     hConn = VRGet( "EF_Conn", "Value" )
  156.     
  157.     ExpReply = VRGet( "CB_3", "Set" )
  158.     WaitReply = VRGet( "CB_4", "Set" )
  159.     
  160.     ret = 'ok = VRMethod( "' || object || '", "' || method || '",' cmd',' data',' respID',' hConn',' ExpReply',' WaitReply ');'
  161.     call Quit
  162. return
  163.  
  164. /*:VRX         PB_Cancel_Click
  165. */
  166. PB_Cancel_Click: 
  167.     ret = '';
  168.     call Quit;
  169. return
  170.  
  171. /*:VRX         Quit
  172. */
  173. Quit:
  174.     window = VRWindow()
  175.     call VRSet window, "Shutdown", 1
  176.     drop window
  177. return
  178.  
  179.