Skip to main content
JHarding
Senior
June 19, 2020
Question

Touches propagating through containers

  • June 19, 2020
  • 4 replies
  • 1362 views

I have multiple containers on the screen at any given time. Most of the time, these containers are on top of each other. Today I just noticed that touching on the top container, will sometimes click a button on the container below it. How can I stop this from happening?

This topic has been closed for replies.

4 replies

Martin KJELDSEN
Principal III
June 21, 2020

How are these containers structured? If you have a background in each that has setTouchable(false); then nothing will fall through. As long as they're overlapping but the top container does not have anything on the entirity of its "canvas" to stop touches from falling through...

/Martin

JHarding
JHardingAuthor
Senior
June 22, 2020

I have a base class called settings menu. This class has a background, a header icon, and a back button and it also controls the menu popping in an out. All of my settings menus extend this base class, and add functionality necessary. The base classes background is a touchgfx::Box and is called mBackgroundBox, I call the function mBackgroundBox.setTouchable(false), yet the touches are still propagating through to the other settings menus behind it.

Any other thoughts?

Edit: Added clarifications

JHarding
JHardingAuthor
Senior
July 22, 2020

@Martin KJELDSEN​ This is still an issue. Do you have any other ideas?

CButz.1
Associate III
March 8, 2024

I know its a old question, but i just stumbled across it, setTouchable needs to be true or else the touches "fall through".