| Version 3 (modified by , 8 years ago) ( diff ) | 
|---|
EVENT
Macro to help create event functions
int EVENT(CForm* pForm, CFormItem* pFormItem, int nFlag);
Parameters
- pForm - pointer to form that called event.
- pFormIten - pointer to form item that activated event such as a button.
- nFlag - flag values
Return Value
Event functions return 0 to stay in the form. Any other return value will cause the form to exit. The function that called FORM_SHOW can read the result.
Remarks
Examples
void MenuScreen(void)
{
    FORM_INIT(Menu, EventMenuShow, NULL, NULL, NULL, nFormFlgShowHelp);
    FORM_ADD_BUTTON(Menu, SetDateTime, 0, 50, "1. Set Date/Time", '1', EventDateTime, FORM_BUTTON);
    FORM_ADD_BUTTON(Menu, ViewAccum, 0, 80, "2. View Accumulators", '2', EventViewAccum, FORM_BUTTON);
    FORM_SHOW(Menu);
    int n = FORM_RUN(Menu);
    FORM_HIDE(Menu);
    // n will contain the return result from any button event that caused the form to exit
}
EVENT(MenuShow)
{
    ClearLCD();
    DisplayText(0, 0, "Menu Screen");
    return 0;
}
EVENT(SetDateTime)
{
    // Hide the parent form
    IN_EVENT_HIDE_FORM;
    DateTimeScreen();
    // Show the parent form
    IN_EVENT_SHOW_FORM;
    return 0;
}
EVENT(ViewAccum)
{
    // Hide the parent form
    IN_EVENT_HIDE_FORM;
    ViewAccumScreen();
    // Show the parent form
    IN_EVENT_SHOW_FORM;
    return 0;
}
See Also
  Note:
 See   TracWiki
 for help on using the wiki.
    ![(please configure the [header_logo] section in trac.ini)](/chrome/site/cardinal.gif)
