home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / BUTTON.$$$ / WINDOW1.VRX < prev    next >
Text File  |  1993-06-18  |  4KB  |  170 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 VRMethod window, "CenterWindow"
  62.     call VRSet window, "Visible", 1
  63.     call VRMethod window, "Activate"
  64. return window
  65.  
  66. /*:VRX         Fini
  67. */
  68. Fini:
  69.     window = VRWindow()
  70.     call VRSet window, 'Visible', '0'
  71.     drop window
  72. return 0
  73. /*:VRX         Halt
  74. */
  75. Halt:
  76.     signal _VREHalt
  77. return
  78.  
  79.  
  80. /*:VRX         Init
  81. */
  82. Init:
  83.     window = VRWindow()
  84.     call VRMethod window, 'CenterWindow'
  85.     call VRSet window, 'Visible', '1'
  86.     call VRMethod window, 'Activate'
  87.     drop window
  88. return
  89.  
  90. /*:VRX         PB_1_Click
  91. */
  92. PB_1_Click:
  93.  
  94.     obj = VRInfo( 'Object' )
  95.  
  96.     color = VRGet( obj, 'Backcolor' )
  97.     if translate(color) = 'RED' then do
  98.         call VRSet obj, 'Backcolor', 'Yellow',,
  99.                         'Caption', 'Yellow'
  100.     end
  101.     else do
  102.         call VRSet obj, 'Backcolor', 'Red',,
  103.                         'Caption', 'Red'
  104.     end
  105.  
  106. return
  107. /*:VRX         PB_2_Click
  108. */
  109. PB_2_Click:
  110.  
  111.     obj = VRInfo( 'Object' )
  112.  
  113.     color = VRGet( obj, 'Backcolor' )
  114.     if translate(color) = 'RED' then do
  115.         call VRSet obj, 'Backcolor', 'Yellow',,
  116.                         'Caption', 'Yellow'
  117.     end
  118.     else do
  119.         call VRSet obj, 'Backcolor', 'Red',,
  120.                         'Caption', 'Red'
  121.     end
  122.  
  123. return
  124. /*:VRX         PB_3_Click
  125. */
  126. PB_3_Click:
  127.  
  128.     obj = VRInfo( 'Object' )
  129.  
  130.     color = VRGet( obj, 'Backcolor' )
  131.     if translate(color) = 'RED' then do
  132.         call VRSet obj, 'Backcolor', 'Yellow',,
  133.                         'Caption', 'Yellow'
  134.     end
  135.     else do
  136.         call VRSet obj, 'Backcolor', 'Red',,
  137.                         'Caption', 'Red'
  138.     end
  139.  
  140. return
  141. /*:VRX         PB_4_Click
  142. */
  143. PB_4_Click:
  144.  
  145.     obj = VRInfo( 'Object' )
  146.  
  147.     color = VRGet( obj, 'Backcolor' )
  148.     if translate(color) = 'RED' then do
  149.         call VRSet obj, 'Backcolor', 'Yellow',,
  150.                         'Caption', 'Yellow'
  151.     end
  152.     else do
  153.         call VRSet obj, 'Backcolor', 'Red',,
  154.                         'Caption', 'Red'
  155.     end
  156.  
  157. return
  158. /*:VRX         Quit
  159. */
  160. Quit:
  161.     window = VRWindow()
  162.     call VRSet window, 'Shutdown', '1'
  163.     drop window
  164. return
  165. /*:VRX         Window1_Close
  166. */
  167. Window1_Close:
  168.     call Quit
  169. return
  170.