Determining Where the User Is Going Next

Sometimes, particularly in end-field and end-form functions, you want to know what the user has requested to do via an event function, whether it is to move to a different item, to a different field on a scrollable region, to exit the form, to quit the form, or go to another form page.

The form next item function, fm_nextitem(), returns the number of the next item to go to or the next action code if the user has requested to move out of the form. The call for fm_nextitem() is as follows:

int fm_nextitem(dfmp)

DFORMPTR dfmp;        /* Form being processed            */

The action codes that fm_nextitem() can return are:

AC_EXIT
AC_QUIT
AC_NEXTFORM
AC_PREVFORM
AC_SAMEITEM
AC_FMSUSPEND

In end-form functions, you can do different types of processing depending on whether the user exited or quit the form. You may wish to do different tasks depending on whether the user is quitting the form or exiting the field or form normally. To do this, use fm_nextitem() to check if the action code is AC_QUIT or something else.

In order to distinguish all exit conditions, you must check for AC_EXIT, AC_QUIT, and VV_ERR not equal to 0. The following code fragment shows how this would be done:

if (VV_ERR)
 
...
/* Code to check for possible run-
*/
...
/* time error conditions that can
*/
...
/* occur in this function 
*/
else if (fm_nextitem(fmp) == AC_QUIT)
 
...
/* Quit without saving data
*/
...
   
else
/* Exit, data converted normally
*/


Home Contents Previous Next