All Vermont Views programs must follow a defined format. This format involves making certain statements and functions calls in the correct order. If you use the Designer and Main Generator to build your application, these steps are automatically included for you in the generated main(). If you do not use the Designer, you must follow these steps in order:
The following code example shows this format. Details on each of the above steps follow.
| #include <vv_....h>/* Include necessary header file(s)*/ /* depending on Vermont Views facilities*/ /* used in your application*/ #include <vv_main.h>/* Include in main program only after all*/ /* other vv_ header files*/ int main(void) { vv_init();/* Initialize Vermont Views*/ vs_clr();/* Clear screen*/ .../* Your code*/ ... vv_exit();/* Exit Vermont Views*/ return(0);/* Standard C return*/ } |
Step 1: Include the header file(s) needed for the facilities you are using.
Definitions and function prototypes are grouped by functionality into several header files. The functional groupings match the basic facilities available in the package. Each header file is named according to the facility it supports. When you include a header file in your application, you bring in all the Vermont Views definitions you need to implement that feature. The header files are provided in source code.
The rules for including header files are as follows:
Table 2.1 lists the names of the header files and what facility they make declarations for. Overall, it is best to think of header files as enabling certain facilities of the package. The only exceptions are vv_errf.h and vv_cua.h. (vv_errf.h disables the VCS error reporting system. vv_cua.h replaces the Vermont Views navigational key definitions with definitions that follow the IBM CUA standards.) Thus, you can pick and choose the features of Vermont Views that you want to use. By only including the declarations you need, you don't include functions, and the associated overhead, that you'll never use.
Some facilities depend on other facilities or sub-systems in Vermont Views. For instance, a decimal field cannot be used without a data form to put it on. Data forms cannot be used without some means to read keyboard or mouse input from the user. And nothing can work if the basic system is not initialized for the display environment.
A header file for any facility of the package #includes any other header file that it needs. Continuing with the decimal field example, from Table 2.1, below, you determine that vv_dec.h is the header file that enables the use of decimal fields on data forms. If you go on to Figure 2.1, you can see that vv_dec.h includes vv_form.h to enable use of data forms. vv_form.h in turn includes vv_key.h, which makes declarations needed for using functions that read the keyboard. vv_key.h in turn includes vv_sys.h.
You do not need to worry about #including any header file more than once. The system ensures that a header file is included only once for any module.
Table 2.1: Header Files to Use for Each Vermont Views Facility
| Facility Desired | Header File to #include |
| Basic display system, including windows and memory files | vv_sys.h |
| Keyboard input | vv_key.h |
| Extended character set | vv_extch.h |
| Your own error reporter (disables VCS error reporting system) | vv_errf.h |
| Interactive viewing and dragging of windows | vv_wnkt.h |
| Choice lists | vv_clist.h |
| List boxes | vv_lbox.h |
| Multi-toggles | vv_mtog.h |
| Spin buttons | vv_spin.h |
| Clipboard support | vv_clip.h |
| Menus (branching) | vv_menu.h |
| Mouse support | vv_mouse.h |
| Common User Access (CUA) keyboard interface (disables VCS navigational keys) | vv_cua.h |
| Common User Access (CUA) border | vv_cuabd.h |
| Help system | vv_help.h |
| Designer panels | vv_des.h |
| Data forms | vv_form.h |
| Boolean fields on data forms | vv_bool.h |
| Character fields on data forms | vv_char.h |
| Check box fields on data forms | vv_check.h |
| Date fields on data forms | vv_date.h |
| Decimal fields on data forms | vv_dec.h |
| Floating point fields, single-precision, on data forms | vv_singl.h |
| Floating point fields, double-precision, on data forms | vv_doubl.h |
| Integer fields on data forms | vv_int.h |
| Long integer fields on data forms | vv_long.h |
| Memo fields on data forms | vv_memo.h |
| Pushbutton fields on data forms | vv_push.h |
| Radio button fields on data forms | vv_radio.h |
| Short integer fields on data forms | vv_short.h |
| Scrollable regions on data forms | vv_sr.h |
| String fields on data forms | vv_str.h |
| Ensures that all memory is freed upon exit | vv_free.h |
| Time fields on data forms | vv_time.h |