Accessing the User Pointer for the Current Field or Form

To get a user pointer that has been installed in a form, data field or memo, use the user pointer get function, :

userp_get(itemp)

PTR itemp;        /* Pointer to form, field or memo         */

userp_get() returns the user pointer for the specified item, whether it is a form, a field, or a memo. You should cast the return value to be of the appropriate type.

For example, to reference the user pointer installed in the above example from within your validation function, use:

int value;

value = *((int *) userp_get(curdfldp(dfmp)));

This code references the user pointer for the current field with userp_get() and casts it to a pointer to an integer. The value of the user pointer is assigned to the variable value.

To access the user pointer for a form, you call the same function, userp_get().


Home Contents Previous Next