Ok peeps,
C++ makes it a lot easier to create forms/fields than C does so here is some code that may help C programmers:
There is a snag to using these functions - you have to create a lengthy procedure to initialise the form fields' data but as this data would be fixed you only do it once in the program and the optimisation would produce quicker programs.
You would use the following procedures:
void form1_init(); //set data for form fields;
void disp_form(form1, 10);//display the form so that all the fields are already on screen
void /*or some data type*/ get_form_data(form1,10);
This takes a lot of work out of allocating data to structures by using repeated gotoxy();printf();scanf(); sequences and allows you to preset the form on screen before data entry.
If/When I get the file module sorted I will post that item as well ...
Hope this helps.
DanJC
bloke 1 "It doesn't work, I've tried it... "
bloke 2 "IT DOES WORK, I'VE DONE IT!!"
C++ makes it a lot easier to create forms/fields than C does so here is some code that may help C programmers:
Code:
//define field structure
struct field
{
int h_pos, v_pos, width;
char caption[35];
char *value;
} form1[10];
//display form
void disp_form( struct field form[], int field_count)
{
int index;
for(index = 0; index < field_count; index ++)
{
gotoxy(form[index].h_pos, form[index].v_pos);
printf("%s",form[index].caption);
}
}
//to enter form data in the appropriate "field location"
void get_form_data(struct field form[], int field_count)
{
int index;
for(index = 0; index < field_count; index++)
{
gotoxy(form[index].h_pos + strlen(form[index].caption) + 2, form[index].v_pos);
scanf("%s", form[index].value);
}
}
There is a snag to using these functions - you have to create a lengthy procedure to initialise the form fields' data but as this data would be fixed you only do it once in the program and the optimisation would produce quicker programs.
You would use the following procedures:
void form1_init(); //set data for form fields;
void disp_form(form1, 10);//display the form so that all the fields are already on screen
void /*or some data type*/ get_form_data(form1,10);
This takes a lot of work out of allocating data to structures by using repeated gotoxy();printf();scanf(); sequences and allows you to preset the form on screen before data entry.
If/When I get the file module sorted I will post that item as well ...
Hope this helps.
DanJC
bloke 1 "It doesn't work, I've tried it... "
bloke 2 "IT DOES WORK, I'VE DONE IT!!"