Options Syntax

Syntax for use of parameters noted as "Options" in the documentation.

DESCRIPTION

This manual entry describes the syntax of the common configuration options supported by widgets in the Tk toolkit as used in Rexx/Tk. (See the Options man page for more info on the available options.) There are three syntax generally allowed as described below. Each syntax will be described in relation to the following example (fictitious) Rexx/Tk call: TkExample(WidgetName, [Options])

Syntax 1

TkExample( WidgetName, -OptionName, OptionValue, -OptionName, OptionValue, ...)

In this syntax, the Option Name and the associated Value are passed in as pairs of arguments with the Option Name being preceded by a hyphen character as in the following example:

rc = TkExample( '.fred', '-text', 'This is a test.')

which sends the TkExample call an Option named "text" with an associated value of "This is a test."

Syntax 2

TkExample( WidgetName, OptionVarName, OptionVarName, OptionVarName, ...)

In this syntax, the Option Name is passed in and the associated value is assumed to be present in a Rexx variable of that name. The variable should be visible in the scope of the function in which it is passed. Example:

text = "This is a test."
font = "helv"
rc = TkExample( '.fred', 'text', 'font')

which sends the TkExample call an Option named "text" with an associated value of "This is a test." And an Option named "font" with an associated value of "helv."

Syntax 3

TkExample( WidgetName, OptionNameStem, OptionValStem)

In this syntax, the stems of a matched pair of arrays are passed in, the first containing a list of Option Names and the second a matched list of Option Values. The zero'th elements of the arrays should be set to the maximum enumerated value, i.e. the number of elements in the array (minus the zero'th element, of course). The Example:

name.1 = "text"
val.1 = "This is a test."
name.2 = "font"
val.2 = "helv"
name.3 = "width"
val.3 = 120
name.4 = "height"
val.4 = 100
name.0 = 4
val.0 = 4
rc = TkExample( '.fred', 'name.', 'val.')

which sends the TkExample call an Option named "text" with an associated value of "This is a test." And an Option named "font" with an associated value of "helv" and an Option named "width" with an associated value of 120, etc.

NOTES:

There are no performance reasons to use one method over the other. The reasons you would choose one method over the other are usually for readability and ease of use, which is in fact why the three methods have been provided.

It has been noted that Syntax 1 can easily produce calls with more arguments than some versions of Rexx can handle. Check your version of Rexx for limitations and use Syntax 2 or 3 for shorter argument lists, if needed.