| 1 | = EVENT = |
| 2 | Macro to help create event functions |
| 3 | |
| 4 | {{{ |
| 5 | int EVENT(CForm* pForm, CFormItem* pFormItem, int nFlag); |
| 6 | }}} |
| 7 | |
| 8 | == Parameters == |
| 9 | |
| 10 | * pForm - pointer to form that called event. |
| 11 | * pFormIten - pointer to form item that activated event such as a button. |
| 12 | * nFlag - flag values |
| 13 | |
| 14 | == Return Value == |
| 15 | |
| 16 | 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. |
| 17 | |
| 18 | == Remarks == |
| 19 | |
| 20 | == Examples == |
| 21 | |
| 22 | {{{ |
| 23 | void MenuScreen(void) |
| 24 | { |
| 25 | FORM_INIT(Menu, EventMenuShow, NULL, NULL, NULL, nFormFlgShowHelp); |
| 26 | FORM_ADD_BUTTON(Menu, SetDateTime, 0, 50, "1. Set Date/Time", '1', EventDateTime, FORM_BUTTON); |
| 27 | FORM_ADD_BUTTON(Menu, ViewAccum, 0, 80, "2. View Accumulators", '2', EventViewAccum, FORM_BUTTON); |
| 28 | |
| 29 | FORM_SHOW(Menu); |
| 30 | FORM_RUN(Menu); |
| 31 | FORM_HIDE(Menu); |
| 32 | } |
| 33 | |
| 34 | EVENT(MenuShow) |
| 35 | { |
| 36 | ClearLCD(); |
| 37 | DisplayText(0, 0, "Menu Screen"); |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | EVENT(SetDateTime) |
| 42 | { |
| 43 | // Hide the parent form |
| 44 | IN_EVENT_HIDE_FORM; |
| 45 | |
| 46 | DateTimeScreen(); |
| 47 | |
| 48 | // Show the parent form |
| 49 | IN_EVENT_SHOW_FORM; |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | EVENT(ViewAccum) |
| 55 | { |
| 56 | // Hide the parent form |
| 57 | IN_EVENT_HIDE_FORM; |
| 58 | |
| 59 | ViewAccumScreen(); |
| 60 | |
| 61 | // Show the parent form |
| 62 | IN_EVENT_SHOW_FORM; |
| 63 | |
| 64 | return 0; |
| 65 | } |
| 66 | }}} |
| 67 | |
| 68 | |
| 69 | == See Also == |
| 70 | |
| 71 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Form/FORM_ADD_INPUT FORM_ADD_INPUT] |
| 72 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Form/FORM_INIT FORM_INIT] |
| 73 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Form/FORM_SHOW FORM_SHOW] |
| 74 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Form/FORM_RUN FORM_RUN] |