How would I go about passing a parm to an oodialog program from the
command line in Windows? Example:
rexx mytest.rex parm1 parm2
Break it into 2 parts.
The first part is passing the args into the Rexx program. You may already know this, but since you asked, I'm going to assume you don't. The command line arguments are passed into the Rexx program as a single string. Then it is just a matter of parsing the string into the arguments.
The parsing is fairly straight forward, but you can make it somewhat complicated if you have a lot of error checking you want to do. For your own program that you are fairly show the arguments will likely be correct, I would do something like:
/* somePrg.rex */
use arg cmdLine
if cmdLine~words <> 2 then do
say 'Syntax: somePrg param1 param2'
param1 = cmdLine~word(1)
param2 = cmdLine~word(2)
I've been accused of not being very "Rexxish," mostly because I'm not. Most Rexx programmers would probably use parse to break the command line arguments down.
Then in InitDialog or a later method, I would like to retrieve the
value(s) of the initiation parameters. Possible?
There are two approaches to passing the arguments on to the dialog subclass. You can add the arguments to the new() invocation for the dialog, or you could add an attribute to your dialog subclass and set them to the value(s) of the imitation parameters.
If you pass them in as extra arguments to the new() method, you need to take care to initialize the super class with the correct arguments. For instance you can't just forward the message in init() to the super class, because the super class doesn't know about those extra arguments. For instance: