About User Functions

User functions are the functions that you, the programmer, write to do the real work of the application. Vermont Views provides you with a variety of hooks—ways to connect your code with the Vermont Views interface. User functions include window activate and suspend functions, begin- and end-form functions, begin- and end-field functions, validation functions, and so on.

Each type of user function uses a specific calling convention; you can't change the number of arguments you send it, nor can you change its return value. When you add your own user functions, you need to know these specifications.

User functions are always passed a pointer to the item being processed. You can use this pointer to access information about the window, form, and fields.

Designer: When you use the Designer to generate a main(), the Designer creates one or two '.c' files for you. The first file is called formname.c, where formname is the name of the form, menu, or window that is active when you generate the main(). The second file, which is only generated if you have attached your own user functions to a panel, is called usr_func.c. usr_func.c contains stub functions for all of your user functions, such as begin- and end-field functions, validation functions, and so on. The Designer creates the stub functions based on the function names that you specified. Stub functions display a window with a message that tells you the name of the function that has been called. Stub functions for menu action functions can also read a sub-form or sub-menu from the Designer library and process that sub-form. You need to turn these stub functions into useful code.

For more information on other Vermont Views functions which may help you write your user functions, such as functions to get a pointer to a field, get or change the field contents, and so on, see Chapter 34, "Getting and Updating Data in the Form."


Home Contents Previous Next