home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / MMW.$$$ / WINDOW1.VRX < prev    next >
Text File  |  1993-09-01  |  3KB  |  139 lines

  1. /*:VRX         Main
  2. */
  3. /*  Main
  4. */
  5. Main:
  6. /*  Process the arguments.
  7.     Get the parent window.
  8. */
  9.     parse source . calledAs .
  10.     parent = ""
  11.     argCount = arg()
  12.     argOff = 0
  13.     if( calledAs \= "COMMAND" )then do
  14.         if argCount >= 1 then do
  15.             parent = arg(1)
  16.             argCount = argCount - 1
  17.             argOff = 1
  18.         end
  19.     end
  20.     InitArgs.0 = argCount
  21.     if( argCount > 0 )then do i = 1 to argCount
  22.         InitArgs.i = arg( i + argOff )
  23.     end
  24.     drop calledAs argCount argOff
  25.  
  26. /*  Load the windows
  27. */
  28.     call VRInit
  29.     parse source . . spec
  30.     _VREPrimaryWindowPath = ,
  31.         VRParseFileName( spec, "dpn" ) || ".VRW"
  32.     _VREPrimaryWindow = ,
  33.         VRLoad( parent, _VREPrimaryWindowPath )
  34.     drop parent spec
  35.     if( _VREPrimaryWindow == "" )then do
  36.         call VRMessage "", "Cannot load window:" VRError(), ,
  37.             "Error!"
  38.         _VREReturnValue = 32000
  39.         signal _VRELeaveMain
  40.     end
  41.  
  42. /*  Process events
  43. */
  44.     call Init
  45.     signal on halt
  46.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  47.         _VREEvent = VREvent()
  48.         interpret _VREEvent
  49.     end
  50. _VREHalt:
  51.     _VREReturnValue = Fini()
  52.     call VRDestroy _VREPrimaryWindow
  53. _VRELeaveMain:
  54.     call VRFini
  55. exit _VREReturnValue
  56.  
  57. VRLoadSecondary: procedure
  58.     name = arg( 1 )
  59.  
  60.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  61.     call VRSet window, "Visible", 1
  62.     call VRMethod window, "Activate"
  63. return window
  64.  
  65. /*:VRX         Fini
  66. */
  67. Fini:
  68.     window = VRWindow()
  69.     call VRSet window, "Visible", 0
  70.     drop window
  71. return 0
  72.  
  73. /*:VRX         Halt
  74. */
  75. Halt:
  76.     signal _VREHalt
  77. return
  78.  
  79. /*:VRX         Init
  80. */
  81. Init:
  82.     window = VRWindow()
  83.     call VRMethod window, "CenterWindow"
  84.     call VRSet window, "Visible", 1
  85.     call VRMethod window, "Activate"
  86.     drop window
  87. return
  88.  
  89. /*:VRX         PB_1_Click
  90. */
  91. PB_1_Click:
  92.  
  93.     call VRLoadSecondary "SW_1"
  94.  
  95. return
  96.  
  97. /*:VRX         PB_2_Click
  98. */
  99. PB_2_Click:
  100.  
  101.     call VRLoadSecondary "SW_2"
  102.  
  103. return
  104.  
  105. /*:VRX         PB_3_Click
  106. */
  107. PB_3_Click:
  108.     call ModalWin VRWindow()
  109. return
  110.  
  111. /*:VRX         Quit
  112. */
  113. Quit:
  114.     window = VRWindow()
  115.     call VRSet window, "Shutdown", 1
  116.     drop window
  117. return
  118.  
  119. /*:VRX         SW_1_Close
  120. */
  121. SW_1_Close:
  122.     window = VRInfo( "Object" )
  123.     call VRDestroy window
  124.     drop window
  125. return
  126. /*:VRX         SW_2_Close
  127. */
  128. SW_2_Close:
  129.     window = VRInfo( "Object" )
  130.     call VRDestroy window
  131.     drop window
  132. return
  133. /*:VRX         Window1_Close
  134. */
  135. Window1_Close:
  136.     call Quit
  137. return
  138.  
  139.