Program Example of a Virtual Data Form

Designer: The tutorial program dvfm_basic.c uses a virtual form created in the Designer. You should compile, link, and run this program to understand how a virtual form looks compared to a regular form.

Code: The following tutorial program, vfm_basic.c, is similar to the code presented in Chapter 6, "Writing Forms in Code." The only difference is that a virtual form is defined. The form window in this example is smaller than the whole form. You should compile, link, and run this program to understand how a virtual data form looks compared to a regular form.

#include <vv_str.h>
/* Include string field header
*/
#include <vv_main.h>



/* Include main
*/
int main(void)



   
{
   
    DFORMPTR dfmp;
/* Declare pointer to form
*/
    UCHAR *lastname, *phone_no;



/* Declare type of data variables
*/
    vv_init();



/* Initialize Vermont Views
*/
    /* Allocate and initialize data variables                   

    lastname = mem_stblank(15);

    phone_no = mem_stblank(12);



*/
    /* Allocate & initialize form                            

    dfmp = fm_vdef(8, 0, 4, 80, LNORMAL, BDR_DLNP, 7, 80);



*/
    /* Define last name field                            

    fld_def(3, 1, "Last Name:     ", FADJACENT, "!XXXXXXXXXXXXXX",

            F_STRING, lastname, dfmp);



*/
    /* Define phone number field                            

    fld_def(5, 1, "Phone number:  ", FADJACENT, "(UUU)UUU-UUUU", 

            F_STRING, phone_no, dfmp);



*/
    fm_proc(0, dfmp);



/* Process example form  
*/
    /* Collect the data from the data variables (not shown)



*/
    fm_free(dfmp);



/* Free memory for form
*/
    /* Free memory allocated for data variables 
*/
    mem_free(lastname);
   
    mem_free(phone_no);
   
    vv_exit();
   
    return(0);
   
}
   


Home Contents Previous Next