home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / SYSTEM.$$$ / FONT.VRM < prev    next >
Text File  |  1993-09-01  |  4KB  |  204 lines

  1. /* Custom mainline for macro */
  2.  
  3.     call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
  4.     call VRLoadFuncs
  5.  
  6.     _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
  7.     if( _VREVersion < 1.01 )then do
  8.         call VRMessage "", "This program requires VX-REXX version 1.01 to run", "Error!"
  9.         _VREReturnValue = 32000
  10.         signal _VRELeaveMain
  11.     end
  12.  
  13.     signal on SYNTAX name _VRESyntax
  14.     signal _VREMain
  15.  
  16. _VRESyntax:
  17.     parse source . . _VRESourceSpec
  18.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
  19.     _VREReturnValue = 32000
  20.     signal _VRELeaveMain
  21.  
  22. _VREMain:
  23. /*:VRX         Main
  24. */
  25. /*  Main
  26. */
  27. Main:
  28. /*  Process the arguments.
  29.     Get the parent window.
  30. */
  31.     parse source . calledAs .
  32.     parent = ""
  33.     argCount = arg()
  34.     argOff = 0
  35.     if( calledAs \= "COMMAND" )then do
  36.         if argCount >= 1 then do
  37.             parent = arg(1)
  38.             argCount = argCount - 1
  39.             argOff = 1
  40.         end
  41.     end
  42.     InitArgs.0 = argCount
  43.     if( argCount > 0 )then do i = 1 to argCount
  44.         InitArgs.i = arg( i + argOff )
  45.     end
  46.     drop calledAs argCount argOff
  47.  
  48. /*  Load the windows
  49. */
  50.     call VRInit
  51.     parse source . . spec
  52.     _VREPrimaryWindowPath = ,
  53.         VRParseFileName( spec, "dpn" ) || ".VRW"
  54.     _VREPrimaryWindow = ,
  55.         VRLoad( parent, _VREPrimaryWindowPath )
  56.     drop parent spec
  57.     if( _VREPrimaryWindow == "" )then do
  58.         call VRMessage "", "Cannot load window:" VRError(), ,
  59.             "Error!"
  60.         _VREReturnValue = 32000
  61.         signal _VRELeaveMain
  62.     end
  63.  
  64. /*  Process events
  65. */
  66.     call Init
  67.     signal on halt
  68.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  69.         _VREEvent = VREvent()
  70.         interpret _VREEvent
  71.     end
  72. _VREHalt:
  73.     _VREReturnValue = Fini()
  74.     call VRDestroy _VREPrimaryWindow
  75. _VRELeaveMain:
  76.     call VRFini
  77. exit _VREReturnValue
  78.  
  79. VRLoadSecondary: procedure
  80.     name = arg( 1 )
  81.  
  82.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  83.     call VRMethod window, "CenterWindow"
  84.     call VRSet window, "Visible", 1
  85.     call VRMethod window, "Activate"
  86. return window
  87.  
  88. /*:VRX         Comments
  89. */
  90. Comments:
  91. /*  
  92.     Font: Generate a prototype for the Font property
  93.  
  94.     Usage:  call Font <Parent>, <Object>, <Property>
  95.  
  96.     Where:  Parent is the parent window for the dialog
  97.         
  98.             Object is the name or id of the object.
  99.  
  100.             Property is always "Font". It is included for
  101.             consistency with other property calls.
  102. */
  103. return
  104.  
  105. /*:VRX         Error
  106. */
  107. Error: procedure
  108.     field = arg( 1 )
  109.     error = arg( 2 )
  110.     call VRMessage VRWindow(), error, "Error"
  111.     call VRMethod field, "SetFocus"
  112. return
  113.  
  114. /*:VRX         Fini
  115. */
  116. Fini:
  117.     window = VRWindow()
  118.     call VRSet window, "Visible", 0
  119.     drop window
  120. return Prototype
  121.  
  122. /*:VRX         Halt
  123. */
  124. Halt:
  125.     signal _VREHalt
  126. return
  127.  
  128. /*:VRX         Init
  129. */
  130. Init:
  131.  
  132.     Prototype = ""
  133.  
  134. /*  Assume 2 arguments: object, property.  
  135. */
  136.     TargetObject = InitArgs.1
  137.     propname = InitArgs.2
  138.     call VRSet "Window1", "Caption", propname
  139.     call VRSet "PB_3", "HintText", "Help for the" propname "property."
  140.     name = TargetObject
  141.     call VRSet 'Object', 'Value', name
  142.  
  143.     window = VRWindow()
  144.     call VRMethod window, "CenterWindow"
  145.     call VRSet window, "Visible", 1
  146.     call VRMethod window, "Activate"
  147.     drop window
  148.  
  149. return
  150.  
  151. /*:VRX         PB_1_Click
  152. */
  153. PB_1_Click:
  154.     object = VRGet( 'Object', 'Value' )
  155.  
  156.     value = VRGet( "Font", "Value" )
  157.     if value = "" then do
  158.         call Error "Font", "You must set a font value."
  159.         return
  160.     end
  161.  
  162.     quotes = VRGet( "Quotes", "Set" )
  163.     if quotes = 1 then do
  164.         value = '"' || value || '"'
  165.     end
  166.  
  167.     Prototype = 'ok = VRSet( "' || object ||,
  168.                               '", "' || propname || '"' ||,
  169.                               ', ' || value ||,
  170.                               ' )'
  171.  
  172.     call Quit
  173.  
  174. return
  175.  
  176. /*:VRX         PB_2_Click
  177. */
  178. PB_2_Click:
  179.     rc = ""
  180.     call Quit
  181. return
  182.  
  183. /*:VRX         PB_3_Click
  184. */
  185. PB_3_Click:
  186.     "view a2z.inf" propname "property"
  187. return
  188.  
  189. /*:VRX         Quit
  190. */
  191. Quit:
  192.     window = VRWindow()
  193.     call VRSet window, "Shutdown", 1
  194.     drop window
  195. return
  196.  
  197. /*:VRX         Window1_Close
  198. */
  199. Window1_Close:
  200.     rc = ""
  201.     call Quit
  202. return
  203.  
  204.