It is easier to write event functions using the existing event functions rather than determine what action codes are appropriate for what system.
When writing functions for a particular system, look at its event table to see what functions are provided and build on these functions. For instance, to write a function that moves the cursor 8 spaces to the left in one move rather than one space at a time, look at the viewing event table. The event function kv_lft() is used in VIEWETP to move one space to the left. You can call this function 8 times in your event function.
To write a function that adds an item to the end of a choice list, look at the CLETP key assignments. In your event function, you would call cli_ins() (using the pointer to the choice list that the event function was passed).
However, you should be aware that the Vermont Views functions that control movement between items on a form, such as kd_nextitem() and kd_previtem(), work by setting the next action code in the form structure and allowing the form editor to perform the actual work. Calling kd_nextitem() a second time in your event function will have no effect; the user will move to the next item on the form, regardless of how many times you call kd_nextitem().
When you call a Vermont Views event function from within your routine, you should return the return value from that function.
In order to call Vermont Views event functions from your code, you may need to initialize an event structure to pass to the Vermont Views function. Many Vermont Views event functions do not use the event structure at all. When calling these functions, it does not matter what you specify for the event pointer. You can pass a NULLP, a pointer to the event structure that was passed into your function, or a pointer to an uninitialized event structure.
Table 38.2 lists the Vermont Views public event functions that do reference the event structure, and shows what each function expects to find in the type and wmsg members of the event structure. None of these functions references the lmsg member of the event structure, although internal Vermont Views functions do use the lmsg member.
Table 38.2: Public Vermont Views Event Functions that Use the Event Structure
| Function name | Event type | wmsg | lmsg |
| kc_chproc() | AC_KEYPRESS | key pressed by user | not used |
| kd_booltoggle() | AC_KEYPRESS | key pressed by user | not used |
| kd_chproc() | AC_KEYPRESS | key pressed by user | not used |
| kd_exit | not used | reason: | not used |
| AC_FMSUSPEND | |||
| AC_EXIT | |||
| AC_QUIT | |||
| AC_NEXTFORM | |||
| AC_PREVFORM | |||
| kd_quit() | AC_KEYPRESS | reason: | not used |
| AC_FMSUSPEND | |||
| AC_EXIT | |||
| AC_QUIT | |||
| AC_NEXTFORM | |||
| AC_PREVFORM | |||
| MOU_OUTMODAL | |||
| kd_spindn() | AC_KEYPRESS | key pressed by user | not used |
| kd_spinup() | AC_KEYPRESS | key pressed by user | not used |
| ke_chproc() | AC_KEYPRESS | key pressed by user | not used |
| km_chproc() | AC_KEYPRESS | key pressed by user | not used |
| kr_default() | AC_KEYPRESS | key pressed by user | not used |