Setting Field Selection Characters

The form option FLDCHSELECT allows you to provide a way for users to select a field on a data form and to move instantly to that field from any other location on the form. When FLDCHSELECT is ON, users can select a field by pressing the Alt key in combination with the selection character associated with that field.

In most cases, the user must press an Alt + character combination to move to another data field, because a single printable character keypress would be interpreted as data input. If the user is in a field for which printable characters are not valid entries (pushbuttons, radio buttons, check boxes, and toggle fields), then a single character may be pressed to select another field.

If FLDCHSELECT is ON, the selection character is set by default to the first character in the field prompt string for all the fields on the form; for pushbuttons, the selection character is set to the first character in the pushbutton text. The selection characters are displayed with the field selection logical attribute LFLDSELCH.

Designer: You can add selection characters to the fields on a data form using the Designer. Select MODIFY->Current form->Options and set FLDCHSELECT to ON. By default, first character selection is turned on for all fields on the form that have been paired with a prompt. See the Designer User's Guide for more information. You can also add selection characters to a Designer form in your code at any time after you have read the form from the Designer library.

Code: To enable field selection characters on a data form, use the following call:

sfm_opt(FLDCHSELECT, ON, dfmp);

For terminal-based systems that may not have an Alt key, a default keystroke sequence is defined in a command string in the vvtermcap entry for the terminal. You can change the default keystroke sequence. If you need more information, see Chapter 58, "Modifying the Terminal Interface."

Changing the Position and Attribute of the Selection Character

Designer: You can change the position and the attribute of the selection character for a field using the Designer. Select MODIFY->Field->Selection character, and complete the dialog box. See the Designer User's Guide for more information.

Code: You can change the position and the attribute of the selection character for a field using the set field selection character function, sf_selectch():

void sf_selectch(ch_pos, ch_att, dfldp)
 
UCHAR ch_pos;
/* Position in prompt or pushbutton text
*/
UCHAR ch_att;
/* Attribute to display selection character
*/
DFIELDPTR dfldp;
/* Pointer to data field
*/

where the first character in the field prompt or pushbutton text is number 0.

Valid selection characters are ['A'..'Z','a'..'z','0'..'9'].

To disable the selection character for a field, use the following call:

sf_selectch(NOSELECT, LFLDSELCH, dfldp);

Creating an Autoselect Field

If the data field is a pushbutton, check box, or Boolean toggle field, you can set the field option FLDAUTOSELECT to ON using sf_opt():

sf_opt(FLDAUTOSELECT, ON, dfldp);

If FLDCHSELECT is ON for the form and FLDAUTOSELECT is ON for a field, pressing the Alt + selection character combination for the field will move the user to the field and initiate an action ("press" the pushbutton, toggle the check box or Boolean toggle field).

See Chapter 9, "Data Field Processing Options," for more information on setting field options.


Home Contents Previous Next