The CLONFIELD choice list option allows you to implement an on-field choice list. An on-field choice list displays only one choice at a time in the choice list window. The choice list window is created to be the same size as the calling field and is placed on the form so that it covers the calling field.
Upon entry into an on-field choice field, the first choice in the list appears in the field. By pressing Down arrow and Up arrow, the user can bring other choices into view in the field. All keys work the same as for any choice list.
To implement an on-field choice list, do the following, either in code or in the Designer:
| 1 | Install a choice list, using CLONFIELD as one of the options. |
| 2 | If you do not want a user to be able to modify a choice after it is selected, set the PROTECTED field option ON. |
Code: As an example, you can rewrite the code example presented earlier in this chapter to make the shipping field have an on-field choice list. To do this, (1) increase the length the shipping field by making it 34 characters long, (2) make a call to sf_opt() to turn the PROTECTED option ON for the shipping field, (3) add the CLONFIELD in the options argument in the sf_clist() call for the shipping field.
This code should look like this:
|
When you recompile and run the program, "UPS UPS Ground Shipment" will be displayed in the shipping field. If you press the Up arrow or Down arrow keys, the entry in the field will change.
Chapter 8, "Extended Data Field Types," contains a description of two other Vermont Views field types that provide functionality similar to a CLONFIELD choice list: multi-toggles and spin buttons.