home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ca100b3.zip / QUEUE.VRM < prev    next >
Text File  |  1995-09-27  |  5KB  |  210 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.         call VROptions 'NoEchoQuit'
  44.     end
  45.     InitArgs.0 = argCount
  46.     if( argCount > 0 )then do i = 1 to argCount
  47.         InitArgs.i = arg( i + argOff )
  48.     end
  49.     drop calledAs argCount argOff
  50.  
  51. /*  Load the windows
  52. */
  53.     call VRInit
  54.     parse source . . spec
  55.     _VREPrimaryWindowPath = ,
  56.         VRParseFileName( spec, "dpn" ) || ".VRW"
  57.     _VREPrimaryWindow = ,
  58.         VRLoad( parent, _VREPrimaryWindowPath )
  59.     drop parent spec
  60.     if( _VREPrimaryWindow == "" )then do
  61.         call VRMessage "", "Cannot load window:" VRError(), ,
  62.             "Error!"
  63.         _VREReturnValue = 32000
  64.         signal _VRELeaveMain
  65.     end
  66.  
  67. /*  Process events
  68. */
  69.     call Init
  70.     signal on halt
  71.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  72.         _VREEvent = VREvent()
  73.         interpret _VREEvent
  74.     end
  75. _VREHalt:
  76.     _VREReturnValue = Fini()
  77.     call VRDestroy _VREPrimaryWindow
  78. _VRELeaveMain:
  79.     call VRFini
  80. exit _VREReturnValue
  81.  
  82. VRLoadSecondary:
  83.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  84.     if __vrlsWait then do
  85.         call VRFlush
  86.     end
  87.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  88.     if __vrlsHWnd = '' then signal __vrlsDone
  89.     if __vrlsWait \= 1 then signal __vrlsDone
  90.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  91.     __vrlsTmp = __vrlsWindows.0
  92.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  93.         __vrlsTmp = 1
  94.     end
  95.     else do
  96.         __vrlsTmp = __vrlsTmp + 1
  97.     end
  98.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  99.     __vrlsWindows.0 = __vrlsTmp
  100.     do while( VRIsValidObject( VRWindow() ) = 1 )
  101.         __vrlsEvent = VREvent()
  102.         interpret __vrlsEvent
  103.     end
  104.     __vrlsTmp = __vrlsWindows.0
  105.     __vrlsWindows.0 = __vrlsTmp - 1
  106.     call VRWindow __vrlsWindows.__vrlsTmp 
  107.     __vrlsHWnd = ''
  108. __vrlsDone:
  109. return __vrlsHWnd
  110.  
  111. /*:VRX         Fini
  112. */
  113. Fini:
  114.     window = VRWindow()
  115.     call VRSet window, "Visible", 0
  116.     drop window
  117. return 0
  118.  
  119. /*:VRX         Halt
  120. */
  121. Halt:
  122.     signal _VREHalt
  123. return
  124.  
  125. /*:VRX         Init
  126. */
  127. Init:
  128.     window = VRWindow()
  129.     call VRMethod window, "CenterWindow"
  130.     call VRSet window, "Visible", 0
  131.     call VRMethod window, "Activate"
  132.     drop window
  133. return
  134.  
  135. /*:VRX         Quit
  136. */
  137. Quit:
  138.     window = VRWindow()
  139.     call VRSet window, "Shutdown", 1
  140.     drop window
  141. return
  142.  
  143. /*:VRX         Window1_Close
  144. */
  145. Window1_Close:
  146.  
  147.     
  148.     call Quit
  149. return
  150.  
  151. /*:VRX         Window1_Create
  152. */
  153. Window1_Create: 
  154.  
  155. rc = VRMethod("Application", "PutClipboard", "")
  156.  
  157. dbpath = VRGetIni("Code Assistant", "DBPATH", "User")
  158.  
  159. win = ""
  160. win = VRMethod('Screen', 'FindWindow', 'Code Assistant', 'Desktop', 'descendents', 'exact', 'exact')
  161. if win == "" then
  162. Do
  163.  
  164.         Buttons.1 = "OK"
  165.         Buttons.0 = 1
  166.         id = VRMessage( VRWindow(), "The Code Assistant program is not active", "Status", "Error", "Buttons.", 1, 1 )
  167.         
  168.  
  169.  
  170. End
  171. Else
  172. Do
  173.     hwndfile = dbpath || '\HWND.DAT'
  174.  
  175.     hwnd = VRGet( "Window1", "HWnd" )
  176.       
  177.     ok = VRCreateFile(hwndfile)
  178.     a = LineOut(hwndfile, hwnd)
  179.                 
  180.     call LineOut(hwndfile) /* close it */
  181.     
  182.     call VRMethod win, "Restore"
  183.     call VRMethod win, "SetFocus" 
  184. End   
  185.  
  186.  
  187.  
  188.    
  189.  
  190. return
  191.  
  192. /*:VRX         Window1_Resize
  193. */
  194. Window1_Resize: 
  195.  
  196.  
  197.     rc = VRMethod("Application", "GetClipboard")
  198.     if rc <> "" then
  199.     Do
  200.         /* VX-REXX Section Editor */
  201.         call VRSEInsertBlock InitArgs.1, rc
  202.         call VRSEActivate InitArgs.1
  203.         
  204.     End
  205.     call Quit
  206.     
  207.  
  208. return
  209.  
  210.