|
|
As it does for items, menus, and fields, ETI supplies a form user pointer for data such as titles, help messages, and the like. These functions enable you to set the pointer and return its referent.
SYNOPSIS
int set_form_userptr (form, userptr) FORM form; char userptr;You can define a structure to be connected to the form using this pointer. By default, the form user pointer is NULL.
``Pattern match example using form user pointer'' illustrates the use of these form user pointer functions to determine whether a given name matches a pattern name. Function main uses set_form_userptr to establish the pattern name, while compare uses form_userptr to fetch the pattern and do the comparison.
#define match(a,b) (strcmp (a, b) == 0)int compare (form, name) FORM * form; char * name; { char * s = form_userptr (form); /* fetch pattern string */ return match (name, s); /* return Boolean indicating match or not */ }
main () { FORM * form; char * form_name; /* initialize form_name to desired string */
set_form_userptr (form, form_name); /* set user pointer to point to string */ }
Pattern match example using form user pointer
For more user pointer examples, see the previous sections on item, menu, and field user pointers and the sample programs in ``ETI program examples''.
If successful, set_form_userptr returns E_OK. If not, it returns the following:
/* change default user pointer */ set_form_userptr((form *) 0, "***");