Getting the Information Entered by the User

To get the current contents of a data field or a memo field, call the field get function, fld_get():

int fld_get(varp, fld_or_memop, fmp)
 
PTR varp;
/*Pointer to variable to place contents of field
*/
FIELDPTR fld_or_memop;
/* Pointer to field or memo to get contents of
*/
FORMPTR dfmp;
/* Form being processed
*/

To get the contents of a field in a scrollable region, call the function srf_get():

int srf_get(varp, data_row, data_col, srp)
 
PTR varp;
/* Pointer to variable to place contents of field
*/
int data_row;
/* Data row of scrollable region
*/
int data_col;
/* Data column of scrollable region
*/
SRPTR srp;
/* Scrollable region
*/

These functions convert the data displayed in the field to the data type specified for the field and place the resulting value in the variable pointed to in the call. These function observes the field option settings that affect data conversion, such as PICSKIP and TRAILBLANKS. The underlying data variable for the field is not changed unless it is used as the variable to place the contents of the field in.

fld_get() can also be used to get the text of a menu field. In this case, the variable should be a string variable long enough to hold the menu field text plus a null terminator.

Caution: The data type of the variable passed must correspond to the field type. To avoid compiler warnings, it should be cast to type PTR in the function call. All string variables must be allocated before calling these functions.


Home Contents Previous Next