home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / colordlg.zip / ColorDlg.VRX < prev    next >
Text File  |  1995-10-05  |  4KB  |  186 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; else do
  20.         call VROptions 'ImplicitNames'
  21.         call VROptions 'NoEchoQuit'
  22.     end
  23.     InitArgs.0 = argCount
  24.     if( argCount > 0 )then do i = 1 to argCount
  25.         InitArgs.i = arg( i + argOff )
  26.     end
  27.     drop calledAs argCount argOff
  28.  
  29. /*  Load the windows
  30. */
  31.     call VRInit
  32.     parse source . . spec
  33.     _VREPrimaryWindowPath = ,
  34.         VRParseFileName( spec, "dpn" ) || ".VRW"
  35.     _VREPrimaryWindow = ,
  36.         VRLoad( parent, _VREPrimaryWindowPath )
  37.     drop parent spec
  38.     if( _VREPrimaryWindow == "" )then do
  39.         call VRMessage "", "Cannot load window:" VRError(), ,
  40.             "Error!"
  41.         _VREReturnValue = 32000
  42.         signal _VRELeaveMain
  43.     end
  44.  
  45. /*  Process events
  46. */
  47.     call Init
  48.     signal on halt
  49.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  50.         _VREEvent = VREvent()
  51.         interpret _VREEvent
  52.     end
  53. _VREHalt:
  54.     _VREReturnValue = Fini()
  55.     call VRDestroy _VREPrimaryWindow
  56. _VRELeaveMain:
  57.     call VRFini
  58. exit _VREReturnValue
  59.  
  60. VRLoadSecondary:
  61.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  62.     if __vrlsWait then do
  63.         call VRFlush
  64.     end
  65.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  66.     if __vrlsHWnd = '' then signal __vrlsDone
  67.     if __vrlsWait \= 1 then signal __vrlsDone
  68.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  69.     __vrlsTmp = __vrlsWindows.0
  70.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  71.         __vrlsTmp = 1
  72.     end
  73.     else do
  74.         __vrlsTmp = __vrlsTmp + 1
  75.     end
  76.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  77.     __vrlsWindows.0 = __vrlsTmp
  78.     do while( VRIsValidObject( VRWindow() ) = 1 )
  79.         __vrlsEvent = VREvent()
  80.         interpret __vrlsEvent
  81.     end
  82.     __vrlsTmp = __vrlsWindows.0
  83.     __vrlsWindows.0 = __vrlsTmp - 1
  84.     call VRWindow __vrlsWindows.__vrlsTmp 
  85.     __vrlsHWnd = ''
  86. __vrlsDone:
  87. return __vrlsHWnd
  88.  
  89. /*:VRX         Background_RB_Click
  90. */
  91. Background_RB_Click: 
  92.  type = "BackColor"
  93. return
  94.  
  95. /*:VRX         Cancel_PB_Click
  96. */
  97. Cancel_PB_Click: 
  98.  color.fore = ''
  99.  color.back = ''
  100.  ok = VRMethod( "Application", "SendKeyString", parent, color.fore color.back )
  101.  Call Quit
  102. return
  103.  
  104. /*:VRX         Color_VS_Click
  105. */
  106. Color_VS_Click: 
  107.  sel = VRGet( "Color_VS", "Selected" )
  108.  ok = VRSet( "Sample_DT", type, color.sel )
  109. return
  110.  
  111. /*:VRX         ColorDlg_Close
  112. */
  113. ColorDlg_Close:
  114.     call Quit
  115. return
  116.  
  117. /*:VRX         ColorDlg_Create
  118. */
  119. ColorDlg_Create: 
  120.  type = 'ForeColor'
  121.  color.1 = Black
  122.  color.2 = Blue
  123.  color.3 = Brown
  124.  color.4 = Cyan
  125.  color.5 = DarkBlue
  126.  color.6 = DarkCyan
  127.  color.7 = DarkGray
  128.  color.8 = DarkGreen
  129.  color.9 = DarkPink
  130.  color.10 = DarkRed
  131.  color.11 = Green
  132.  color.12 = PaleGray
  133.  color.13 = Pink
  134.  color.14 = Red
  135.  color.15 = White
  136.  color.16 = Yellow
  137. return
  138.  
  139. /*:VRX         Fini
  140. */
  141. Fini:
  142.     window = VRWindow()
  143.     call VRSet window, "Visible", 0
  144.     drop window
  145. return 0
  146.  
  147. /*:VRX         Foreground_RB_Click
  148. */
  149. Foreground_RB_Click: 
  150.  type = "ForeColor"
  151. return
  152.  
  153. /*:VRX         Halt
  154. */
  155. Halt:
  156.     signal _VREHalt
  157. return
  158.  
  159. /*:VRX         Init
  160. */
  161. Init:
  162.     window = VRWindow()
  163.     call VRMethod window, "CenterWindow"
  164.     call VRSet window, "Visible", 1
  165.     call VRMethod window, "Activate"
  166.     drop window
  167. return
  168.  
  169. /*:VRX         Ok_PB_Click
  170. */
  171. Ok_PB_Click: 
  172.  color.fore = VRGet( "Sample_DT", "ForeColor" )
  173.  color.back = VRGet( "Sample_DT", "BackColor" )
  174.  ok = VRMethod( "Application", "SendKeyString", parent, color.fore color.back )
  175.  Call Quit
  176. return
  177.  
  178. /*:VRX         Quit
  179. */
  180. Quit:
  181.     window = VRWindow()
  182.     call VRSet window, "Shutdown", 1
  183.     drop window
  184. return
  185.  
  186.