Writing Event Functions for SYSETP

You can place context-free event functions in the system event table. Since the system event table is always searched first, you may install event functions that need to be accessible from any part of your application in this table.

Because the system event table is used with all processing systems, event functions installed in this event table will be passed a pointer to a variety of structures. Therefore, it is best to write event functions that do not need to access information in the passed structure.

To make use of the structure passed, you must first determine what type it is by using the structure tag member. A structure tag member is specified for all structures passed to event functions. The following code illustrates how to use these tags in a system event function:

int usr_keyfunc(kcp, eventp)

KEYCTRLPTR kcp;

EVENTPTR eventp;

{

    HELPPTR hp;

    CLISTPTR clp;

    {

      if (kcp->tag == HELP_TAG)

      {
 
          hp = (HELPPTR) kcp;
/* Help system specific code
*/
      }

      else if (kcp->tag == CL_TAG)

      {
 
          clp = (CLISTPTR) kcp;
/* Choice list system specific code
*/
      }

      else if         

      ...

}

/* Code for all other cases
*/

Table 38.3: Structure Tags

Structure Tag Member Name Tag
CLISTPTR clp->tag CL_TAG
DFORMPTR dfmp->tag FORMTAG
HELPPTR helpp->tag HELP_TAG
KEYCTRLPTR kcp->tag VIEW_TAG
MFORMPTR mfmp->tag FORMTAG


Home Contents Previous Next