Vermont Views functions that work on items need a pointer to that item.
Items can be identified by pointers, by the number of the item in the form (i.e., the processing order) or by a name that you have specified for a data field, memo field, or scrollable region.
Designer: To name an item, specify the name when you create the item. You can control the processing order from within the Designer. See the Designer User's Guide for details.
Code: To name a data field, memo field, or a scrollable region, use the function i_namset():
|
The processing order of the fields is the order in which they are defined. The first field that you define is field 0, the second is field 1, and so on. This is the order in which the cursor will move through the fields.
General: There is a family of functions that provide a means of translating from one item identifier to another. The known identifier is specified as a parameter, and the desired identifier is returned. These functions are listed in Table 9.4 and are described in more detail in Chapter 34, "Getting and Updating Data in the Form."
Table 9.4: Functions to Translate Field Identifiers
| Type | Function Name | Translation |
| int | (name_stp, dfmp) | Name to number |
| PTR | (name_stp, dfmp) | Name to pointer |
| UCHAR * | (item_num, dfmp) | Number to name |
| PTR | (item_num, dfmp) | Number to pointer |
| UCHAR * | (itemp) | Pointer to name |
| int | (itemp, dfmp) | Pointer to number |
Caution: For functions that return pointers, you must cast the returned pointer to the appropriate type. For example,
|
Designer: You can change field option settings in the Designer. You can also change them in your code, at any point after you have read the form from the Designer library.
Code: You can change field option settings at any time after you call fld_def() to define the field.
General: You can change field option settings before the form is processed, or in a user function that is called during form processing. The latter is useful if you need to modify field options based on user input. For example, on an invoice form, if the user indicates that the preferred method of payment is by credit card, you may need to make some fields REQUIRED to ensure that the user enters all necessary credit card information—credit card number, expiration date, and so on.
To change a field's option settings in code, use the function:
|
The options argument contains options that you want changed, combined with the bitwise OR operator, for example, CLEARONKEY | RTENTRY | INITIALBLANKS. You can change more than one option at once, as long as all the options specified are to have the state specified in the call. Options that were previously set for the field are not changed by this call.
Designer: For example, the following code fragment changes a field named "cc_number" to a protected field:
|
Code: For example, the following code fragment creates a password (noecho) field:
|