home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxcliser.zip / VXREXX.2 / MACROS / VXREZ / RESOURCE.VRX < prev    next >
Text File  |  1994-12-23  |  5KB  |  224 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         Bitmap_Click
  67. */
  68. Bitmap_Click:
  69.     if( VRGet( 'Bitmap', 'Set' ) = 1 )then do
  70.         call EnableOptions
  71.     end
  72.     call CheckFields
  73. return
  74.  
  75. /*:VRX         Cancel_Click
  76. */
  77. Cancel_Click:
  78.     InsertString = ""
  79.     call Quit
  80. return
  81.  
  82. /*:VRX         CheckFields
  83. */
  84. CheckFields:
  85.     if( VRGet( 'DefaultIcon', 'Set' ) = 1 & VRGet( 'File', 'Value' ) \= '' )then
  86.         call VRSet 'OK', 'Enabled', 1
  87.     else if( VRGet( 'ID', 'Value' ) \= '' & VRGet( 'File', 'Value' ) \= '' )then
  88.         call VRSet 'OK', 'Enabled', 1
  89.     else  
  90.         call VRSet 'OK', 'Enabled', 0
  91. return
  92.  
  93. /*:VRX         DefaultIcon_Click
  94. */
  95. DefaultIcon_Click:
  96.     if( VRGet( 'DefaultIcon', 'Set' ) = 1 )then do
  97.         call DisableOptions
  98.     end
  99.     call CheckFields
  100. return
  101.  
  102. /*:VRX         DisableOptions
  103. */
  104. DisableOptions:
  105.     call VRSet 'Preload', 'Enabled', 0
  106.     call VRSet 'Moveable', 'Enabled', 0
  107.     call VRSet 'Discardable', 'Enabled', 0
  108. return
  109.  
  110. /*:VRX         EnableOptions
  111. */
  112. EnableOptions:
  113.     call VRSet 'Preload', 'Enabled', 1
  114.     call VRSet 'Moveable', 'Enabled', 1
  115.     call VRSet 'Discardable', 'Enabled', 1
  116. return
  117.  
  118. /*:VRX         File_Change
  119. */
  120. File_Change:
  121.     call CheckFields
  122. return
  123.  
  124. /*:VRX         Fini
  125. */
  126. Fini:
  127.     window = VRWindow()
  128.     call VRSet window, "Visible", 0
  129.     drop window
  130. return InsertString
  131.  
  132. /*:VRX         Halt
  133. */
  134. Halt:
  135.     signal _VREHalt
  136. return
  137.  
  138. /*:VRX         Icon_Click
  139. */
  140. Icon_Click:
  141.     if( VRGet( 'Icon', 'Set' ) = 1 )then do
  142.         call EnableOptions
  143.     end
  144.     call CheckFields
  145. return
  146.  
  147. /*:VRX         ID_Change
  148. */
  149. ID_Change:
  150.     call CheckFields
  151. return
  152.  
  153. /*:VRX         Init
  154. */
  155. Init:
  156.  
  157.     if( InitArgs.0 > 1 )then do
  158.         file = InitArgs.2
  159.         ext = translate( VRParseFilePath( file, "e" ) )
  160.         if( ext = "ICO" )then do
  161.             call VRSet 'Icon', 'Set', 1
  162.         end; else do
  163.             call VRSet 'Bitmap', 'Set', 1
  164.         end
  165.         call VRSet 'File', 'Value', file
  166.     end
  167.  
  168.     window = VRWindow()
  169.     call VRMethod window, "CenterWindow"
  170.     call VRSet window, "Visible", 1
  171.     call VRMethod window, "Activate"
  172.     drop window
  173. return
  174.  
  175. /*:VRX         OK_Click
  176. */
  177. OK_Click:
  178.     id   = VRGet( 'ID', 'Value' )
  179.     file = VRGet( 'File', 'Value' )
  180.     if( VRGet( 'DefaultIcon', 'Set' ) = 1 )then do
  181.         InsertString = 'DEFAULTICON' file
  182.     end; else do
  183.         if( VRGet( 'Bitmap', 'Set' ) = 1 )then
  184.             type = 'BITMAP'
  185.         else
  186.             type = 'ICON'
  187.          
  188.         options = ''
  189.         if( VRGet( 'Preload', 'Set' ) = 1 )then do
  190.             options = options 'PRELOAD'
  191.         end
  192.         if( VRGet( 'Discardable', 'Set' ) = 1 )then do
  193.             options = options 'DISCARDABLE'
  194.         end
  195.         if( VRGet( 'Moveable', 'Set' ) = 1 )then do
  196.             options = options 'MOVEABLE'
  197.         end
  198.  
  199.         InsertString = type id options file
  200.     end
  201.     call Quit
  202. return
  203.  
  204. /*:VRX         Quit
  205. */
  206. Quit:
  207.     window = VRWindow()
  208.     call VRSet window, "Shutdown", 1
  209.     drop window
  210. return
  211.  
  212. /*:VRX         Window1_Close
  213. */
  214. Window1_Close:
  215.     call Quit
  216. return
  217.  
  218. /*:VRX         Window1_Help
  219. */
  220. Window1_Help: 
  221.     address cmd 'view progguid.inf Adding resources to your project'
  222. return
  223.  
  224.