How to use VGDD

From VirtualFabWiki
Jump to: navigation, search

The easiest way to use VGDD is to use its Wizard

However, if you want (complicated) instructions on how to use it manually, here is the relative page

--

FAQ

Where do I put my code?

The best place for user code that interacts with GUI objects are the Events. This way your code remains tightly bound to the object that fires it and can be easily found by selecting its relative Widget while you are designing the interface.

But you can also put your code in the main GOLMsgCallback function, as in MCHP demos.

An even better place could be a user module, to be added to the project, with relevant user code, as you wish.

An example could be the following:

WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg) {
WORD id= GetObjID(pObj);
switch (screenState) {
    case DISPLAY_MAIN:
        switch (id) {
            case ID_BUTTON_MENU:
                if (objMsg == BTN_MSG_RELEASED) {
                    CustomCode_Menu();
                    return (1);
                }
                                    .
                                    .
                                    .
        }
    return (VGDD_xxxx_MsgCallback(objMsg, pObj, pMsg));
}

In this example, hitting the MENU button will be handled before the standard VGDD event code is called (VGDD_xxxx_MsgCallback) so the CustomCode_Menu() function will be called instead. It can be in a separate user module, whose headers #include should be manually added on top of the main.c as usual.