Resources | Resources |



Creating a listener callback function

The code for the button listener callback function in c_simple_widget_app is shown below. c_simple_widget_app_ButtonListener() is only interested in the EVT_MDL_WIDGETELEM_CLICK event, and calls a function to display the date or time when this occurs. Otherwise, the callback does nothing.

static void c_simple_widget_app_ButtonListener(c_simple_widget_app * pMe,
            ModelEvent* pEvt)
   if (EVT_MDL_WIDGETELEM_CLICK == pEvt->evCode) {
    		if (!c_simple_widget_app_DisplayDateTime(pMe)) {
   			DBGPRINTF("display date/time failed");

The c_simple_widget_app_DisplayDateTime() function determines which radio button was selected and then displays the date or time. For more information, see Using value models to display date or time widgets.