home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vsecom3.zip / PROJECT.VRX < prev    next >
Text File  |  1994-12-06  |  3KB  |  120 lines

  1. /*:VRX Main */
  2. /*  Main
  3. */
  4. Main:
  5. /*  Process the arguments.
  6.     Get the parent window.
  7. */
  8.     parse source . calledAs .
  9.     parent = ""
  10.     argCount = arg()
  11.     argOff = 0
  12.     if( calledAs \= "COMMAND" )then do
  13.         if argCount >= 1 then do
  14.             parent = arg(1)
  15.             argCount = argCount - 1
  16.             argOff = 1
  17.         end
  18.     end; else do
  19.         call VROptions 'ImplicitNames'
  20.     end
  21.     InitArgs.0 = argCount
  22.     if( argCount > 0 )then do i = 1 to argCount
  23.         InitArgs.i = arg( i + argOff )
  24.     end
  25.     drop calledAs argCount argOff
  26.  
  27. /*  Load the windows
  28. */
  29.     call VRInit
  30.     parse source . . spec
  31.     _VREPrimaryWindowPath = ,
  32.         VRParseFileName( spec, "dpn" ) || ".VRW"
  33.     _VREPrimaryWindow = ,
  34.         VRLoad( parent, _VREPrimaryWindowPath )
  35.     drop parent spec
  36.     if( _VREPrimaryWindow == "" )then do
  37.         call VRMessage "", "Cannot load window:" VRError(), ,
  38.             "Error!"
  39.         _VREReturnValue = 32000
  40.         signal _VRELeaveMain
  41.     end
  42.  
  43. /*  Process events
  44. */
  45.     call Init
  46.     signal on halt
  47.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  48.         _VREEvent = VREvent()
  49.         interpret _VREEvent
  50.     end
  51. _VREHalt:
  52.     _VREReturnValue = Fini()
  53.     call VRDestroy _VREPrimaryWindow
  54. _VRELeaveMain:
  55.     call VRFini
  56. exit _VREReturnValue
  57.  
  58. VRLoadSecondary:
  59.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  60.     if __vrlsWait then do
  61.         call VRFlush
  62.     end
  63.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  64.     if __vrlsHWnd = '' then signal __vrlsDone
  65.     if __vrlsWait \= 1 then signal __vrlsDone
  66.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  67.     __vrlsTmp = __vrlsWindows.0
  68.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  69.         __vrlsTmp = 1
  70.     end
  71.     else do
  72.         __vrlsTmp = __vrlsTmp + 1
  73.     end
  74.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  75.     __vrlsWindows.0 = __vrlsTmp
  76.     do while( VRIsValidObject( VRWindow() ) = 1 )
  77.         __vrlsEvent = VREvent()
  78.         interpret __vrlsEvent
  79.     end
  80.     __vrlsTmp = __vrlsWindows.0
  81.     __vrlsWindows.0 = __vrlsTmp - 1
  82.     call VRWindow __vrlsWindows.__vrlsTmp 
  83.     __vrlsHWnd = ''
  84. __vrlsDone:
  85. return __vrlsHWnd
  86.  
  87. /*:VRX Halt */
  88. Halt:
  89.     signal _VREHalt
  90. return
  91.  
  92. /*:VRX Init */
  93. Init:
  94.     window = VRWindow()
  95.     call VRMethod window, "CenterWindow"
  96.     call VRSet window, "Visible", 1
  97.     call VRMethod window, "Activate"
  98.     drop window
  99. return
  100.  
  101. /*:VRX Quit */
  102. Quit:
  103.     window = VRWindow()
  104.     call VRSet window, "Shutdown", 1
  105.     drop window
  106. return
  107.  
  108. /*:VRX Fini */
  109. Fini:
  110.     window = VRWindow()
  111.     call VRSet window, "Visible", 0
  112.     drop window
  113. return 0
  114.  
  115. /*:VRX Window7_Close */
  116. Window7_Close:
  117.     call Quit
  118. return
  119.  
  120.