home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vxdemo.zip / SYSTEM.$$$ / RF5PARM.VRM < prev    next >
Text File  |  1993-09-01  |  6KB  |  245 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.     RF3Parm: Generate a prototype for 3 parameter REXX functions
  93.  
  94.     Usage:  call RF3Parm <Parent>, <Function>
  95.  
  96.     Where:  Parent is the parent window for the dialog
  97.  
  98.             Function is the function that is using this macro.
  99. */
  100. return
  101.  
  102. /*:VRX         Error
  103. */
  104. Error: procedure
  105.     field = arg( 1 )
  106.     error = arg( 2 )
  107.     call VRMessage VRWindow(), error, "Error"
  108.     call VRMethod field, "SetFocus"
  109. return
  110.  
  111. /*:VRX         Fini
  112. */
  113. Fini:
  114.     window = VRWindow()
  115.     call VRSet window, "Visible", 0
  116.     drop window
  117. return Prototype
  118.  
  119. /*:VRX         Halt
  120. */
  121. Halt:
  122.     signal _VREHalt
  123. return
  124.  
  125. /*:VRX         Init
  126. */
  127. Init:
  128.  
  129.     Prototype = ""
  130.  
  131.     TargetObject = InitArgs.1
  132.     argument = InitArgs.2
  133.     parse var argument Funcname "_" Retval "_" v1 "_" v2 "_" v3 "_" v4 "_" v5
  134.     call VRSet "Window1", "Caption", funcname
  135.     call VRSet "PB_3", "HintText", "Help for the" funcname "function."
  136.     call VRSet "DT_1", "Caption", v1 || ":"
  137.     call VRSet "Value1", "HintText", "Set the" v1 "parameter."
  138.     call VRSet "Quotes1", "HintText", "Uncheck this if" v1 "is a variable."
  139.     call VRSet "DT_2", "Caption", v2 || ":"
  140.     call VRSet "Value2", "HintText", "Set the" v2 "parameter."
  141.     call VRSet "Quotes2", "HintText", "Uncheck this if" v2 "is a variable."
  142.     call VRSet "DT_3", "Caption", v3 || ":"
  143.     call VRSet "Value3", "HintText", "Set the" v3 "parameter."
  144.     call VRSet "Quotes3", "HintText", "Uncheck this if" v3 "is a variable."
  145.     call VRSet "DT_4", "Caption", v4 || ":"
  146.     call VRSet "Value4", "HintText", "Set the" v4 "parameter."
  147.     call VRSet "Quotes4", "HintText", "Uncheck this if" v4 "is a variable."
  148.     call VRSet "DT_5", "Caption", v5 || ":"
  149.     call VRSet "Value5", "HintText", "Set the" v5 "parameter."
  150.     call VRSet "Quotes5", "HintText", "Uncheck this if" v5 "is a variable."
  151.  
  152.     window = VRWindow()
  153.     call VRMethod window, "CenterWindow"
  154.     call VRSet window, "Visible", 1
  155.     call VRMethod window, "Activate"
  156.     drop window
  157.  
  158. return
  159.  
  160. /*:VRX         PB_1_Click
  161. */
  162. PB_1_Click:
  163.     value1 = VRGet( "Value1", "Value" )
  164.  
  165.     quotes1 = VRGet( "Quotes1", "Set" )
  166.     if quotes1 = 1 then do
  167.         value1 = '"' || value1 || '"'
  168.     end
  169.  
  170.     value2 = VRGet( "Value2", "Value" )
  171.     quotes2 = VRGet( "Quotes2", "Set" )
  172.     if quotes2 = 1 then do
  173.         value2 = '"' || value2 || '"'
  174.     end
  175.     if value2 \= "" then do
  176.         value2 = ", " || value2
  177.     end
  178.  
  179.     value3 = VRGet( "Value3", "Value" )
  180.     quotes3 = VRGet( "Quotes3", "Set" )
  181.     if quotes3 = 1 then do
  182.         value3 = '"' || value3 || '"'
  183.     end
  184.     if value3 \= "" then do
  185.         value3 = ", " || value3
  186.     end
  187.  
  188.     value4 = VRGet( "Value4", "Value" )
  189.     quotes4 = VRGet( "Quotes4", "Set" )
  190.     if quotes4 = 1 then do
  191.         value4 = '"' || value4 || '"'
  192.     end
  193.     if value4 \= "" then do
  194.         value4 = ", " || value4
  195.     end
  196.  
  197.     value5 = VRGet( "Value5", "Value" )
  198.     quotes5 = VRGet( "Quotes5", "Set" )
  199.     if quotes5 = 1 then do
  200.         value5 = '"' || value5 || '"'
  201.     end
  202.     if value5 \= "" then do
  203.         value5 = ", " || value5
  204.     end
  205.  
  206.     Prototype = Retval ' = ' || Funcname ||,
  207.                            '( ' || value1 ||,
  208.                            value2 ||,
  209.                            value3 ||,
  210.                            value4 ||,
  211.                            value5 || ' )'
  212.  
  213.     call Quit
  214.  
  215. return
  216.  
  217. /*:VRX         PB_2_Click
  218. */
  219. PB_2_Click:
  220.     rc = ""
  221.     call Quit
  222. return
  223.  
  224. /*:VRX         PB_3_Click
  225. */
  226. PB_3_Click:
  227.     "view rexx.inf" funcname
  228. return
  229.  
  230. /*:VRX         Quit
  231. */
  232. Quit:
  233.     window = VRWindow()
  234.     call VRSet window, "Shutdown", 1
  235.     drop window
  236. return
  237.  
  238. /*:VRX         Window1_Close
  239. */
  240. Window1_Close:
  241.     rc = ""
  242.     call Quit
  243. return
  244.  
  245.