Using Linked Data Forms

If you are using linked data forms (that is, you have linked two or more data forms together by using MODIFY->Current form->Page links in the Designer), you must read each form individually out of the library. The linking is done automatically for you when the form is processed.

For example, suppose the data forms form1, form2, and form3 have been created in the library des_tut.vvd. None of the forms have user-installed functions or use choice lists.

Before writing code, you must create the data structure for each form.

Shown below are the declarations and code to get the three forms from the library and process them. Similar code is given in the file fm_link.c in the tutorial directory.

#include <vv_clib.h>
/* Include appropriate header files
*/
#include <vv_int.h>
   
#include <vv_des.h>
   
#include <form1.h>
/* Data structure for form1 data
*/
#include <form2.h>
/* Data structure for form2 data
*/
#include <form3.h>
/* Data structure for form3 data
*/
DLIBPTR dlibp;
/* Pointer to Designer library
*/
#ifdef LINT_ARG

int CDECL main(void);

#else

int CDECL main();

#endif



int CDECL main()

{

   
DFORMPTR dfmp;
/* Pointer to Designer form
*/
FORM1 form1;    
/* Data storage for form1
*/
FORM2 form2;
/* Data storage for form2
*/
FORM3 form3;
/* Data storage for form3
*/
vv_init();
/* Initialize Vermont Views
*/
vs_clr();
/* Clear the screen
*/
    /* Initialize the data storage                        

    memset(&form1, '\0', sizeof(FORM1))

    memset(&form2, '\0', sizeof(FORM2))

    memset(&form3, '\0', sizeof(FORM3))
*/
    /* Open the library and get the forms                    

    if (dlibp = dl_open("des_tut.vvd"))

    {
*/
        if (!(dfmp = dl_fmget("form2", &form2, NULLP, NULLP, dlibp)))

            goto ERROR;

        if (!(dfmp = dl_fmget("form3", &form3, NULLP, NULLP, dlibp)))

            goto ERROR;

        if (dfmp = dl_fmget("form1", &form1, NULLP, NULLP, dlibp))

        {
 
            fm_proc(0, dfmp);
/* Process the forms
*/
            fm_free(dfmp);
/* Free the forms
*/
        }



   
Error:
   
            dl_close(dlibp);
/* Close the library
*/
        }
   
    vv_exit();
/* Exit Vermont Views
*/
    return(1)
   
}
   

Functions are provided that return the name of the next or previous form, so that you can determine which forms to get from the library more easily. These functions are as follows:

UCHAR *fm_nextfmname(dfmp)

DFORMPTR dfmp;    /* Pointer to next Designer form            */

UCHAR *fm_prevfmname(dfmp)

DFORMPTR dfmp;    /* Pointer to previous Designer form        */

These functions return a pointer to a string that can be passed to dl_fmget().


Home Contents Previous Next