Creating a New Event Code

To create a new event code, you need a name and an integer value for this event. Vermont Views event names start with "AC_" for action code; you may follow this convention if you wish. You can find the names of all the predefined Vermont Views events in two header files: vv_sys.h contains most of the event names, and vv_sr.h contains some names for events that are specific to scrollable regions.

The integer value for the event type is the value used to look up the event in an event table. Vermont Views events begin with the number 32000, with the exception of the AC_NULLEVENT event code, which is 0. For compatibility with future releases of Vermont Views, we suggest that you do not use integer values above 32000 for your events. You also should not use values in the range from 0 to 5000, as many of these values are returned by ki() when the user presses a particular key or key combination on the keyboard.

Once you have decided on a name and an integer value for your new event type, create a #define for the event to associate the name with the integer value, like this:

#define AC_MYEVENT
5001

You should place this statement in vv_sys.h or in one of your header files. It creates a new event type, AC_MYEVENT, which has an integer value of 5001. You can then use AC_MYEVENT in your calls to et_rplevnt() to insert the event code-event function pair into an event table, and in your event structure as the event type.


Home Contents Previous Next