Form calls the user edit routine with the type parameter equal
to U_USEREDIT any time the operator exits a field that has the user edit
field set to yes. The edit_name parameter points to the name specified
in the edit field name field in the field description form. If the edit field
name is blank, then the edit_name parameter points to the field name.
The old_value parameter points to the original contents of the field
when the operator first entered the field. The new_value parameter points
to the current contents of the field (which could be the same as the original
contents). The exit_char parameter contains the key that was typed to
exit the field. This could be the TAB key, the RETURN key, one of the cursor
arrow keys, one of the form function keys, or an ASCII printable character.
The following table shows the key codes for form function keys as defined in \cbase\include\cbase\form.h.
Form Function Keys
F_QUERY F_DELETE
F_QUERYFIRST F_QUERYLAST
F_FIND F_CLEAR
F_FINDNEXT F_FINDPREV
F_UPDATE F_REFRESH
F_ADD F_HOME
F_STORE F_CANCEL
F_NEXTFORM F_HELP
F_PREVFORM F_NEXTUPDATE
F_FIRSTFORM F_VALFORM
F_VALEXIT F_EXIT
Form calls the user edit routine each time the cursor passes through the field whether or not any changes are made. It is up to the user edit routine to decide whether it should perform any action when called to edit the field. After the operator exits the field (by typing past the end of the field or pressing an arrow or function key), form performs the following steps:
1. Strip trailing blanks from the field value
2. Verify the field value against the field data type
3. Reformat the data if necessary (such as adding a decimal point and right-justifying numbers)
4. Validate the field value with a validation file (if specified in the field description form)
5. Evaluate the edit/match formula (if specified in the field description form)
6. Call the U_USEREDIT user_edit routine
7. Recalculate formulas in other fields that depend on the value in this field
If any of the above steps fail (for example, your U_USEREDIT routine returns a pointer to an error message), form displays the error message and moves the cursor to the beginning of the current field. Only when your U_USEREDIT user edit routine returns NULL will form continue on to the next field.