Programming Guide |
Puts a string into a field
int sm_putfield(int field_number, char *data);int sm_e_putfield(char *field_name, int element, char *data);int sm_i_putfield(char *field_name, int occurrence, char *data);int sm_n_putfield(char *field_name, char *data);int sm_o_putfield(int field_number, int occurrence, char *data);
field_name, field_number
- The field to receive the contents of
data
.element
- The element in array
field_name
to receive the string.occurrence
- The occurrence in the field to receive the string.
data
- A pointer to the string to put in the specified field or occurrence.
- 0 Success.
sm_putfield
moves the string indata
into the specified field, if it differs from the existing value. If the string is too long, Panther truncates it without warning. If the string is shorter than the destination field, Panther blank fills it according to the field's justification. If data points to an empty string, the field is cleared. This refreshes date and time fields that take system values.
sm_putfield
sets the field'smdt
property toPV_YES
to indicate that it is modified, and clears its valided property toPV_NO
to indicate that the field requires validation on exit. If you use variantssm_n_putfield
orsm_i_putfield
andfield_name
is absent from the screen, the value of data is put in the corresponding LDB entry.
#include <smdefs.h>
sm_putfield(1, "This string has 29 characters");
sm_deselect, sm_dtofield, sm_getfield, sm_itofield, sm_ltofield