You can use the form pointer passed to the form and field validation functions to get information about the form and about the fields on the form. You can get a pointer to an item on the form in one of several ways. If the item is the current item on the form, you can call a Vermont Views function to return a pointer to the current item. If the item is not the current item (or if you are not sure whether it is the current item), you can use the field or scrollable region name, or the processing number of the item, to get a pointer to that item.
For example, to determine the item number currently being processed, use the following code:
|
The following chart shows the functions that return pointers to the current item.
Table 32.2: Functions That Return a Pointer to the Current Item
| Type | Function Name | Returns |
| PTR | curitemp(dfmp) | Pointer to current item |
| DFIELDPTR | curdfldp(dfmp) | Pointer to current data field |
| MEMOPTR | curmemop(dfmp) | Pointer to current memo field |
| SRPTR | cursrp(dfmp) | Pointer to current scrollable region |
The following chart shows the functions that translate from one field identifier to another.
Table 32.3: Functions That Translate One Field Identifier to Another
| Type | Function Name | Translation |
| int | i_namnum(name_stp, dfmp) | Name to number |
| PTR | i_namptr(name_stp, dfmp) | Name to pointer |
| UCHAR * | i_numnam(item_num, dfmp) | Number to name |
| PTR | i_numptr(item_num, dfmp) | Number to pointer |
| UCHAR * | i_ptrnam(itemp) | Pointer to name |
| int | i_ptrnum(itemp, dfmp) | Pointer to number |
curitemp(), i_namptr() and i_numptr() return pointers to the desired item. You should cast the return values from these functions to be the appropriate type in your code. For example, if you have a scrollable region named my_sr on your form, the following code fragment gets a pointer to that scrollable region:
|