DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
ETI forms

Setting and fetching the form user pointer

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;
   

char * form_userptr (form) FORM * form;

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:


E_SYSTEM_ERROR -
system error
As usual, you change the default by passing set_form_userptr a NULL form pointer. So to change the default user pointer to point to the string ***, you write:
   		/* change default user pointer */
   set_form_userptr((form *) 0, "***");

Next topic: Setting and fetching form options
Previous topic: Repositioning the cursor after printing page number

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004