Resources | Resources |



Event handling in widget-based applications

When a widget-based application receives events, it must forward the key and pointer events to the root container. Touch-enabled applications receive pointer events when the user touches the screen. The root container uses the location information for the event and the widgets to determine which widget should receive the event, then passes the event to the parent container of the widget, which similarly determines which child widget should receive the event. This continues until the appropriate widget receives the event. If the widget is touch-enabled, it passes pointer events to its Touch Controller.

The event handling mechanism can be extended by supplying a custom handler, which is called in the place of the default handler. This enables an application to extend the event handler for any component that has support for the IHandler interface. 

Capture mode

When a widget sets capture mode, all future pointer events will be sent to that widget, regardless of the location of the event, until a pointer up event is received or the widget releases capture.

Only one widget at a time can have capture mode set. If a widget sets capture mode, any widget that has capture mode set is forced to release it.

When a widget has set capture mode, the normal routing for pointer events, which is based on the location of the event and the widgets, does not apply. All pointer events are sent to the capture widget.

For more information, see IWidget_SetCapture() in the

Tap and click events

Prior to Brew MP, the following widgets sent click events to listeners:

  • Button widget
  • List widget
  • Softkey widget
  • Grid container

In Brew MP, these widgets send both click and tap events.

It is recommended that applications listen for tap events, which provide the coordinates of the tap, instead of listening for click events and then using the pointer event to determine the location. Tap events provide the required information.