Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > INFLD > INFLD Parameters > setdef

List of Valid Inputs

Scroll Prev Top Next More

If the field is not a date, and the type  {  (character set list) is not specified, then setdef is interpreted as a list of possible complete entries. In text mode, the choices will display on the bottom line of the terminal (as many as will fit) to assist the operator, unless disabled with the  s  code. A null string disables the feature—i.e., accepts all inputs.

If setdef is specified as a string, the format is:

/x1/x2/x3/x4/..../xn//)

Where:

Represents the element delimiter. It may be any non-numeric character except the minus sign. We suggest slash or comma. Note that the delimiter character must appear once in the first position, once between each element in the list (all blanks are significant), and twice at the end of the list.

xn - The elements x1, x2, etc., represent the allowable inputs. They may be any length (up to the length of the field) and may differ in length. All characters are significant, as is upper/lower case.

The list elements may contain any of the following wildcards:

Wildcard

Result

*

Matches anything. Used only at the end of an element.

?

Matches any one character.

#

Matches any numeric digit.

@

Matches any alphabetic digit.

 

setdef may also be specified as an ordered map (see History below), whose keys will be used as the items in the list (x1, x2, ... in the string version described above), and the values are ignored. For example:

dimx $colors, ordmap(varstr; varstr)  

 

$colors("red") = ""        ! values ignored here

$colors("green") = ""

$colors("blue") = ""

 

xcall INFLD, row, col, xmax, xmin, entry, inxctl, pid, op, exitcode, timer, cmdflg, defpt, maxpt, funmap, $colors()

 

The string equivalent of the above would be:

map1 setdef$,s,0

setdef$ = "\red\green\blue\\"

xcall INFLD, row, col, xmax, xmin, entry, inxctl, pid, op, exitcode, timer, cmdflg, defpt, maxpt, funmap, setdef$

 

The string version is actually simpler to set up, but the ordered map version may be handier in situations where the map already exists for other reasons.

In GUI mode (type code |G), a field with this type of setdef list will be converted to a drop-down combo box or spinner. (See GUI-Related Codes  for additional type codes that adjust the behavior of the combo box, particularly ||C, |M, ||S, ||s, ||U and ||W). Note that in this mode, the length of the items in the list may be longer than xmax, in which case the entry only has to match the first xmax characters of an item in the list—and only the first xmax characters are returned to the calling program. An example of a situation where this would be useful is a list of states, where you are only interested in the 2 character code, but to be helpful to the operator, the drop-down list could also contain the full name of each state.  Also see List of Paired Inputs for an alternate way to handle this scenario.

See Also

type ||C for forcing the field to be displayed as a combo box even when inactive. Without ||C, after exiting from the combo box editing mode, the field will be redisplayed as a normal sunken, static text field.
||S and ||s for variations on the combo box matching logic.
cmdflg INFCF_DROPDOWN flag to force drop-down to open automatically

History

2023 March, A-Shell 6.5.1727:  Add support to setdef for Ordered Maps