wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/Form/FORM_ADD_BUTTON

Version 1 (modified by Don Wilson, 14 years ago) ( diff )

--

FORM_ADD_BUTTON

Adds a button item to a form.

void FORM_ADD_BUTTON(formName name, buttonName, int x, int y, const char* pszText, char cShortcut, EVENT_FNC event, uint32 nFlag, const char* pszHelp, int nIDVal = 0);

Parameters

  • formName - name of the form, this much match the name of the FORM_INIT
  • buttonName - name of the input, this must be unique within this form
  • x - X coordinate (0 - 639)
  • y - Y coordinate (0 - 479)
  • pszText - Text to display in button
  • cShortcut - Shortcut key to press to activate button
  • event - Event to be called when button is activated, may be NULL to not call event
  • nFlag - Flags such as FORM_UINT8_SEL to show selection data
  • pszHelp - Help text to be displayed at the bottom of screen when field is selected
  • nIDVal - ID that may be used for return value when button is pressed if event function is not used

Return Value

This function does not return any value

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);
    FORM_RUN(Menu);
    FORM_HIDE(Menu);
}

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

  • FORM_ADD_INPUT
  • FORM_ADD_BUTTON
  • FORM_SHOW
  • FORM_RUN
Note: See TracWiki for help on using the wiki.