home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxcliser.zip / VRCS.3 / CHTSAMP / CLICK / WINDOW1.VRX < prev    next >
Text File  |  1994-12-23  |  3KB  |  136 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.     /* Destroy the window
  70.     */
  71.     
  72.     window = VRWindow()
  73.     call VRSet window, "Visible", 0
  74.     drop window
  75. return Retcode
  76.  
  77. /*:VRX         Halt
  78. */
  79. Halt:
  80.     signal _VREHalt
  81. return
  82.  
  83. /*:VRX         Init
  84. */
  85. Init:
  86.     /* Change the DT and EF according to the selection
  87.        made.
  88.     */
  89.  
  90.     call VRSet "DT_name", "Caption", InitArgs.1
  91.     call VRSet "EF_name", "Value", InitArgs.2
  92.  
  93.     /* Create the window
  94.     */
  95.  
  96.     window = VRWindow()
  97.     call VRMethod window, "CenterWindow"
  98.     call VRSet window, "Visible", 1
  99.     call VRMethod window, "Activate"
  100.     drop window
  101. return
  102.  
  103. /*:VRX         PB_Cancel_Click
  104. */
  105. PB_Cancel_Click:
  106.     RetCode = ""
  107.     call Quit
  108. return
  109.  
  110. /*:VRX         PB_OK_Click
  111. */
  112. PB_OK_Click:
  113.     /* Return the new value.
  114.     */
  115.  
  116.     value = VRGet( "EF_name", "Value" )
  117.     Retcode = value
  118.  
  119.     call Quit
  120. return
  121.  
  122. /*:VRX         Quit
  123. */
  124. Quit:
  125.     window = VRWindow()
  126.     call VRSet window, "Shutdown", 1
  127.     drop window
  128. return
  129.  
  130. /*:VRX         Window1_Close
  131. */
  132. Window1_Close:
  133.     call Quit
  134. return
  135.  
  136.