home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxcliser.zip / VXREXX.2 / MACROS / VXREZ / RESOURCE.VRM < prev    next >
Text File  |  1994-12-23  |  5KB  |  236 lines

  1. /* Custom mainline for macro */
  2.  
  3.     signal on SYNTAX name _VRESyntax
  4.     signal _VREMain
  5.  
  6. _VRESyntax:
  7.     parse source . . _VRESourceSpec
  8.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!"
  9.     call VRFini
  10.     exit 32000
  11.  
  12. _VREMain:
  13. /*:VRX         Main
  14. */
  15. /*  Main
  16. */
  17. Main:
  18. /*  Process the arguments.
  19.     Get the parent window.
  20. */
  21.     parse source . calledAs .
  22.     parent = ""
  23.     argCount = arg()
  24.     argOff = 0
  25.     if( calledAs \= "COMMAND" )then do
  26.         if argCount >= 1 then do
  27.             parent = arg(1)
  28.             argCount = argCount - 1
  29.             argOff = 1
  30.         end
  31.     end
  32.     InitArgs.0 = argCount
  33.     if( argCount > 0 )then do i = 1 to argCount
  34.         InitArgs.i = arg( i + argOff )
  35.     end
  36.     drop calledAs argCount argOff
  37.  
  38. /*  Load the windows
  39. */
  40.     call VRInit
  41.     parse source . . spec
  42.     _VREPrimaryWindowPath = ,
  43.         VRParseFileName( spec, "dpn" ) || ".VRW"
  44.     _VREPrimaryWindow = ,
  45.         VRLoad( parent, _VREPrimaryWindowPath )
  46.     drop parent spec
  47.     if( _VREPrimaryWindow == "" )then do
  48.         call VRMessage "", "Cannot load window:" VRError(), ,
  49.             "Error!"
  50.         _VREReturnValue = 32000
  51.         signal _VRELeaveMain
  52.     end
  53.  
  54. /*  Process events
  55. */
  56.     call Init
  57.     signal on halt
  58.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  59.         _VREEvent = VREvent()
  60.         interpret _VREEvent
  61.     end
  62. _VREHalt:
  63.     _VREReturnValue = Fini()
  64.     call VRDestroy _VREPrimaryWindow
  65. _VRELeaveMain:
  66.     call VRFini
  67. exit _VREReturnValue
  68.  
  69. VRLoadSecondary: procedure
  70.     name = arg( 1 )
  71.  
  72.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  73.     call VRMethod window, "CenterWindow"
  74.     call VRSet window, "Visible", 1
  75.     call VRMethod window, "Activate"
  76. return window
  77.  
  78. /*:VRX         Bitmap_Click
  79. */
  80. Bitmap_Click:
  81.     if( VRGet( 'Bitmap', 'Set' ) = 1 )then do
  82.         call EnableOptions
  83.     end
  84.     call CheckFields
  85. return
  86.  
  87. /*:VRX         Cancel_Click
  88. */
  89. Cancel_Click:
  90.     InsertString = ""
  91.     call Quit
  92. return
  93.  
  94. /*:VRX         CheckFields
  95. */
  96. CheckFields:
  97.     if( VRGet( 'DefaultIcon', 'Set' ) = 1 & VRGet( 'File', 'Value' ) \= '' )then
  98.         call VRSet 'OK', 'Enabled', 1
  99.     else if( VRGet( 'ID', 'Value' ) \= '' & VRGet( 'File', 'Value' ) \= '' )then
  100.         call VRSet 'OK', 'Enabled', 1
  101.     else  
  102.         call VRSet 'OK', 'Enabled', 0
  103. return
  104.  
  105. /*:VRX         DefaultIcon_Click
  106. */
  107. DefaultIcon_Click:
  108.     if( VRGet( 'DefaultIcon', 'Set' ) = 1 )then do
  109.         call DisableOptions
  110.     end
  111.     call CheckFields
  112. return
  113.  
  114. /*:VRX         DisableOptions
  115. */
  116. DisableOptions:
  117.     call VRSet 'Preload', 'Enabled', 0
  118.     call VRSet 'Moveable', 'Enabled', 0
  119.     call VRSet 'Discardable', 'Enabled', 0
  120. return
  121.  
  122. /*:VRX         EnableOptions
  123. */
  124. EnableOptions:
  125.     call VRSet 'Preload', 'Enabled', 1
  126.     call VRSet 'Moveable', 'Enabled', 1
  127.     call VRSet 'Discardable', 'Enabled', 1
  128. return
  129.  
  130. /*:VRX         File_Change
  131. */
  132. File_Change:
  133.     call CheckFields
  134. return
  135.  
  136. /*:VRX         Fini
  137. */
  138. Fini:
  139.     window = VRWindow()
  140.     call VRSet window, "Visible", 0
  141.     drop window
  142. return InsertString
  143.  
  144. /*:VRX         Halt
  145. */
  146. Halt:
  147.     signal _VREHalt
  148. return
  149.  
  150. /*:VRX         Icon_Click
  151. */
  152. Icon_Click:
  153.     if( VRGet( 'Icon', 'Set' ) = 1 )then do
  154.         call EnableOptions
  155.     end
  156.     call CheckFields
  157. return
  158.  
  159. /*:VRX         ID_Change
  160. */
  161. ID_Change:
  162.     call CheckFields
  163. return
  164.  
  165. /*:VRX         Init
  166. */
  167. Init:
  168.  
  169.     if( InitArgs.0 > 1 )then do
  170.         file = InitArgs.2
  171.         ext = translate( VRParseFilePath( file, "e" ) )
  172.         if( ext = "ICO" )then do
  173.             call VRSet 'Icon', 'Set', 1
  174.         end; else do
  175.             call VRSet 'Bitmap', 'Set', 1
  176.         end
  177.         call VRSet 'File', 'Value', file
  178.     end
  179.  
  180.     window = VRWindow()
  181.     call VRMethod window, "CenterWindow"
  182.     call VRSet window, "Visible", 1
  183.     call VRMethod window, "Activate"
  184.     drop window
  185. return
  186.  
  187. /*:VRX         OK_Click
  188. */
  189. OK_Click:
  190.     id   = VRGet( 'ID', 'Value' )
  191.     file = VRGet( 'File', 'Value' )
  192.     if( VRGet( 'DefaultIcon', 'Set' ) = 1 )then do
  193.         InsertString = 'DEFAULTICON' file
  194.     end; else do
  195.         if( VRGet( 'Bitmap', 'Set' ) = 1 )then
  196.             type = 'BITMAP'
  197.         else
  198.             type = 'ICON'
  199.          
  200.         options = ''
  201.         if( VRGet( 'Preload', 'Set' ) = 1 )then do
  202.             options = options 'PRELOAD'
  203.         end
  204.         if( VRGet( 'Discardable', 'Set' ) = 1 )then do
  205.             options = options 'DISCARDABLE'
  206.         end
  207.         if( VRGet( 'Moveable', 'Set' ) = 1 )then do
  208.             options = options 'MOVEABLE'
  209.         end
  210.  
  211.         InsertString = type id options file
  212.     end
  213.     call Quit
  214. return
  215.  
  216. /*:VRX         Quit
  217. */
  218. Quit:
  219.     window = VRWindow()
  220.     call VRSet window, "Shutdown", 1
  221.     drop window
  222. return
  223.  
  224. /*:VRX         Window1_Close
  225. */
  226. Window1_Close:
  227.     call Quit
  228. return
  229.  
  230. /*:VRX         Window1_Help
  231. */
  232. Window1_Help: 
  233.     address cmd 'view progguid.inf Adding resources to your project'
  234. return
  235.  
  236.