home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_06_06
/
v6n6020a.txt
< prev
next >
Wrap
Text File
|
1989-09-28
|
3KB
|
69 lines
\NLETTER\6.6\LIST2.LST
Listing 2:
C-Worthy:
form = InitForm(NO_MESSAGE, 0, 0, 6, 51, DEFAULT_BORDER,
TOTAL_FIELDS, NAME_FIELD, OTHER_INFO_FIELD,
SIMPLE_FORM_HELP_CONTEXT);
/* Create the name field and set the data pointer */
InitField(&form->dataField[NAME_FIELD], FT_STRING,
info.status[NAME_FIELD], FF_NO_FLAGS, NO_HELP_CONTEXT,
0, 14, NAME_PROMPT, 0, 20, 30, NO_PROCEDURE, NO_PROCEDURE);
StringInit(&form->dataField[NAME_FIELD],
NullPointer(char), 40, NO_PROCEDURE, SF_NAME_CASE);
form->dataField[NAME_FIELD].data = (BYTE *)info.name;
/* Create the birthdate field and set the data pointer */
InitField(&form->dataField[BIRTHDATE_FIELD], FT_DATE,
info.status[BIRTHDATE_FIELD], FF_NO_FLAGS, NO_HELP_CONTEXT,
1, 8, BIRTHDATE_PROMPT, 1, 20, 18, NO_PROCEDURE, NO_PROCEDURE);
DateInit(&form->dataField[BIRTHDATE_FIELD],
0, 0, 0, -2, -2, -2, 1,
NullPointer(char), NO_PROCEDURE, DF_USE_SHORT_ALPHA_MONTH);
form->dataField[BIRTHDATE_FIELD].data = (BYTE *)&info.birthDate;
/* Create the sex field and set the data pointer */
InitField(&form->dataField[SEX_FIELD], FT_BOOLEAN,
info.status[SEX_FIELD], FF_NO_FLAGS, NO_HELP_CONTEXT,
1, 39, SEX_PROMPT, 1, 44, 6, NO_PROCEDURE, NO_PROCEDURE);
BooleanInit(&form->dataField[SEX_FIELD],
0, MALE, FEMALE);
form->dataField[SEX_FIELD].data = (BYTE *)&info.sex;
/* Create the height field and set the data pointer */
InitField(&form->dataField[HEIGHT_FIELD], FT_BYTE,
info.status[HEIGHT_FIELD], FF_NO_FLAGS, NO_HELP_CONTEXT,
2, 3, HEIGHT_PROMPT, 2, 20, 6, NO_PROCEDURE, NO_PROCEDURE);
ByteInit(&form->dataField[HEIGHT_FIELD],
0, "30..96", NO_DECIMAL_PLACES, NO_PROCEDURE, NF_NORMAL);
form->dataField[HEIGHT_FIELD].data = (BYTE *)&info.height;
/* Create the weight field and set the data pointer */
InitField(&form->dataField[WEIGHT_FIELD], FT_INTEGER,
info.status[WEIGHT_FIELD], FF_NO_FLAGS, NO_HELP_CONTEXT,
2, 27, WEIGHT_PROMPT, 2, 44, 6, NO_PROCEDURE, NO_PROCEDURE);
IntegerInit(&form->dataField[WEIGHT_FIELD],
0, "0..500", NO_DECIMAL_PLACES, NO_PROCEDURE, NF_NORMAL);
form->dataField[WEIGHT_FIELD].data = (BYTE *)&info.weight;
/* Create the other information field and set the data pointer */
InitField(&form->dataField[OTHER_INFO_FIELD], FT_VISIBLE_TEXT,
info.status[OTHER_INFO_FIELD], FF_NO_FLAGS, NO_HELP_CONTEXT,
3, 1, OTHER_INFO_PROMPT, 3, 20, 30, NO_PROCEDURE, NO_PROCEDURE);
VisibleTextInit(&form->dataField[OTHER_INFO_FIELD],
3, 30, NullPointer(char), 512);
form->dataField[OTHER_INFO_FIELD].data = (BYTE *)info.otherInformation;
/* Set the default form field movement */
SetDefaultFormMovement(form, ROW_MOVEMENT, NO_WRAPPING);
/* Change the help message and edit the form */
ChangeMessageLine(HELP_LINE, CENTER_JUSTIFY, GENERAL_HELP_MESSAGE);
EditForm(form, FC_NO_FLAGS, NOPROC);
/* Save the form's status flags and then destroy the form */
for (count = 0; count < TOTAL_FIELDS; count++)
info.status[count] = form->dataField[count].status;
DestroyForm(form);