Skip to main content
Mvill.17
Associate III
November 26, 2020
Question

About Container

  • November 26, 2020
  • 2 replies
  • 840 views

I draw a container in a screen over all the other controls (such as buttons etc).

Background buttons continue to respond to click event as they were in foreground.

In my opinion this is not correct: they should be disabled by default.

I had to put: setTouchable(true) in the container to have a right behaviour.

Is this a BUG?

This topic has been closed for replies.

2 replies

Michael K
Senior III
December 10, 2020

To prevent button touches beneath containers, you can add the ClickListener mixin to the container. You don't have to add any other code. This way the topmost container only will capture the click event, and will essentially discard it.

This is handy for preventing the user from touching elements beneath Modal windows, for instance. I also use it for preventing hardfaults when dragging the dynamic graph widget!

Embedded UI/UX Consulting: cadenza.design
Flemming Gram CHRISTENSEN
ST Employee
December 11, 2020

Mvill.17, that is not a bug. This is the intention. The first touchable widget will receive the click event.

Of course you could discuss if a Container should collect events as default. But atm. it inherits the behaviour from Drawable, that it is not touchable.