# Event propagation in Widget 2.x

**URL:** <https://forum.microej.com/t/event-propagation-in-widget-2-x/655>\
**Category:** Guides\
**Tags:** ui\
**Created:** [January 29, 2020, 3:30pm UTC](https://forum.microej.com/t/event-propagation-in-widget-2-x/655 "2020-01-29T15:30:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![microej\_official](https://forum.microej.com/user_avatar/forum.microej.com/microej_official/32/45_2.png) [@microej\_official](https://forum.microej.com/u/microej_official)\
**Post date:** [January 29, 2020, 3:30pm UTC](https://forum.microej.com/t/event-propagation-in-widget-2-x/655/1 "2020-01-29T15:30:59Z")

</div>

The MicroUI 2.x events (touch, buttons…) are sent to the application in the same order as they are generated.  
In MicroUI, events are sent to the [controller](http://developer.microej.com/javadoc/microej_5.x/foundation/ej/microui/display/Displayable.html#getController--) of the displayable that is shown on the display.  
In MWT, events are sent to the controller of the Desktop that dispatches the event to its children widgets.

## Pointer Events

Pointer events are grouped in sessions. A session starts when the pointer is pressed, and ends when the pointer is released.  
While no renderable consumes the events, they are sent to the renderable that is under the pointer, then sent to all its parent hierarchy. Once a renderable has consumed an event, every other event in the session is sent to it.  
The renderable under the pointer is requested using [Desktop.panelAt()](http://developer.microej.com/javadoc/microej_5.x/addons/ej/mwt/Desktop.html#panelAt-int-int-) and [Panel.getWidgetAt()](http://developer.microej.com/javadoc/microej_5.x/addons/ej/mwt/Panel.html#getWidgetAt-int-int-). By default every widget is considered as a rectangular area. This area can be modified by subclassing [Widget.contains()](http://developer.microej.com/javadoc/microej_5.x/addons/ej/mwt/Widget.html#contains-int-int-).

 ![image](https://forum.microej.com/uploads/default/original/1X/74aad1a32840084d140a216af5342e250a50507e.png)

## Other Events

For other events, the events are sent to the [focus owner](http://developer.microej.com/javadoc/microej_5.x/addons/ej/mwt/Panel.html#getFocus--) of the [active panel](http://developer.microej.com/javadoc/microej_5.x/addons/ej/mwt/Desktop.html#getActivePanel--), then sent to all its parent hierarchy while the event is not consumed.

 ![image](https://forum.microej.com/uploads/default/original/1X/1ca2b7ffb81a2f56a7266018c55ae43fba0384e4.png)

---

<div class="post-metadata">

**Author:** ![microej\_official](https://forum.microej.com/user_avatar/forum.microej.com/microej_official/32/45_2.png) [@microej\_official](https://forum.microej.com/u/microej_official)\
**Post date:** [February 6, 2020, 3:28pm UTC](https://forum.microej.com/t/event-propagation-in-widget-2-x/655/2 "2020-02-06T15:28:56Z")

</div>

Listed on February 6, 2020, 3:28pm UTC



---

<div class="post-metadata">

**Author:** ![gaetan.harel](https://forum.microej.com/user_avatar/forum.microej.com/gaetan.harel/32/44_2.png) [@gaetan.harel](https://forum.microej.com/u/gaetan.harel)\
**Post date:** [February 7, 2020, 10:42am UTC](https://forum.microej.com/t/event-propagation-in-widget-2-x/655/3 "2020-02-07T10:42:46Z")

</div>

Closed on February 7, 2020, 10:42am UTC


