home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / SYSTEM.$$$ / GETVAL.VRM < prev    next >
Text File  |  1993-08-27  |  4KB  |  161 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.     call VRMessage "", "Syntax error in line" SIGL, "Error!"
  18.     _VREReturnValue = 32000
  19.     signal _VRELeaveMain
  20.  
  21. _VREMain:
  22. /*:VRX         Main
  23. */
  24. /*  Main
  25. */
  26. Main:
  27. /*  Process the arguments.
  28.     Get the parent window.
  29. */
  30.     parse source . calledAs .
  31.     parent = ""
  32.     argCount = arg()
  33.     argOff = 0
  34.     if( calledAs \= "COMMAND" )then do
  35.         if argCount >= 1 then do
  36.             parent = arg(1)
  37.             argCount = argCount - 1
  38.             argOff = 1
  39.         end
  40.     end
  41.     InitArgs.0 = argCount
  42.     if( argCount > 0 )then do i = 1 to argCount
  43.         InitArgs.i = arg( i + argOff )
  44.     end
  45.     drop calledAs argCount argOff
  46.  
  47. /*  Load the windows
  48. */
  49.     call VRInit
  50.     parse source . . spec
  51.     _VREPrimaryWindowPath = ,
  52.         VRParseFileName( spec, "dpn" ) || ".VRW"
  53.     _VREPrimaryWindow = ,
  54.         VRLoad( parent, _VREPrimaryWindowPath )
  55.     drop parent spec
  56.     if( _VREPrimaryWindow == "" )then do
  57.         call VRMessage "", "Cannot load window:" VRError(), ,
  58.             "Error!"
  59.         _VREReturnValue = 32000
  60.         signal _VRELeaveMain
  61.     end
  62.  
  63. /*  Process events
  64. */
  65.     call Init
  66.     signal on halt
  67.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  68.         _VREEvent = VREvent()
  69.         interpret _VREEvent
  70.     end
  71. _VREHalt:
  72.     _VREReturnValue = Fini()
  73.     call VRDestroy _VREPrimaryWindow
  74. _VRELeaveMain:
  75.     call VRFini
  76. exit _VREReturnValue
  77.  
  78. VRLoadSecondary: procedure
  79.     name = arg( 1 )
  80.  
  81.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  82.     call VRMethod window, "CenterWindow"
  83.     call VRSet window, "Visible", 1
  84.     call VRMethod window, "Activate"
  85. return window
  86.  
  87. /*:VRX         Comments
  88. */
  89. Comments:
  90. /*  
  91.     NoParms: Generate a prototype for methods without parameters
  92.  
  93.     Usage:  call CenterW <Parent>, <Object>, <Method>
  94.  
  95.     Where:  Parent is the parent window for the dialog
  96.         
  97.             Object is the name or id of the window to center.   
  98.  
  99.             Method is the name of the method using the macro
  100. */
  101. return
  102.  
  103. /*:VRX         Error
  104. */
  105. Error: procedure
  106.     field = arg( 1 )
  107.     error = arg( 2 )
  108.     call VRMessage VRWindow(), error, "Error"
  109.     call VRMethod field, "SetFocus"
  110. return
  111.  
  112. /*:VRX         Fini
  113. */
  114. Fini:
  115.     window = VRWindow()
  116.     call VRSet window, "Visible", 0
  117.     drop window
  118. return Prototype
  119.  
  120. /*:VRX         Halt
  121. */
  122. Halt:
  123.     signal _VREHalt
  124. return
  125.  
  126. /*:VRX         Init
  127. */
  128. Init:
  129.  
  130.     Prototype = ""
  131.  
  132. /*  Assume 2 arguments: object, method.  
  133. */
  134.     TargetObject = InitArgs.1
  135.     propname = InitArgs.2
  136.     lpropname = translate( propname, "abcdefghijklmnopqrstuvwxyz", ,
  137.                                      "ABCDEFGHIJKLMNOPQRSTUVWXYZ" )
  138.  
  139.     Prototype = lpropname || ' = VRGet( "' || TargetObject ||,
  140.                                '", "' || propname || '" )'
  141.  
  142.     call Quit
  143.  
  144. return
  145.  
  146. /*:VRX         Quit
  147. */
  148. Quit:
  149.     window = VRWindow()
  150.     call VRSet window, "Shutdown", 1
  151.     drop window
  152. return
  153.  
  154. /*:VRX         Window1_Close
  155. */
  156. Window1_Close:
  157.     rc = ""
  158.     call Quit
  159. return
  160.  
  161.