cancel
Showing results for 
Search instead for 
Did you mean: 

Drawable::setTouchable() seems to be inverted?

GHeller
Associate III

I googled this and found nothing, so here it goes.

According to the documentation:

setTouchable(true) - enables touch events.

setTouchable(false) - disables touch events.

This however seems to not be the case in my software. I am using TouchGFX 4.18.1 and a template for STM32H750B-DK version 3.0.6.

I have made an error pupup window with a box with alpha 0 covering the entire screen in order to lock any touch events behind the popup window. I have wasted too much time in order to accidentaly discover, that the setTouchable() function works opposite to what was intented. So currently I'm using setTouchable(true) to disable touch events, and setTouchable(false) to enable them.

Is this a bug with my software, or maybe is this a simulator bug (I haven't tested it on harware yet) or maybe is it actually intended?

1 ACCEPTED SOLUTION

Accepted Solutions
Yoann KLEIN
ST Employee

Yes you are right, when you put your container at the first position in the list, it means that this element is on foreground. Then, if you use setTouchable(true) on that element, it will gather all touch interactions on the area covered by it (in your case the whole screen I guess).

I'm not sure about what you wanna do with this popup or how it should work, but you can take a look at a similar post here, which might help you : https://community.st.com/s/question/0D53W00000LF2lySAD/touchgfx-popup-container-doesnt-block-a-buttons-under-it

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

View solution in original post

4 REPLIES 4
Yoann KLEIN
ST Employee

Hi GHell.1,

I just tried to reproduce the error you are running into, without success.

I also used a STM32H750B-DK template (Button Example), with the same version of TouchGFX, and everything seems to work as the documentation says, in the Simulator but also on target.

Maybe you can try to create a new project and import UI ? Or starting a new project and UI from scratch again ?

Let me know how it is going,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

Thank you for your response. Does setTouchable(true) mean that the object is gathering all touch interactions, which means everything under this object in Z order (everything below it in the project tree) doesn't get touch interactions? Because after making a brand new project and testing it on two buttons, this is the only conclusion I can come up with.

To explain further, currently I enable my error pop-up with setVisible(true) and setTouchable(true). The error pop-up container is at the top of my tree, right below MainScreen. I disable it with the false equivalents of the above functions. From what I understood from the documentation and my intuition, this combination should be setVisible(true) and setTouchable(false) in order to enable, and setVisible(false) and setTouchable(true) in order to disable the pop-up, while also disabling/enabling touch interactions with anything below the pop-up. This seems to not be the case.

Yoann KLEIN
ST Employee

Yes you are right, when you put your container at the first position in the list, it means that this element is on foreground. Then, if you use setTouchable(true) on that element, it will gather all touch interactions on the area covered by it (in your case the whole screen I guess).

I'm not sure about what you wanna do with this popup or how it should work, but you can take a look at a similar post here, which might help you : https://community.st.com/s/question/0D53W00000LF2lySAD/touchgfx-popup-container-doesnt-block-a-buttons-under-it

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

Thank you, this is exactly what I was missing. The pop-up will be displaying error messages and I wanted to disable all touch interactions behind it in order to prevent the user from pressing another, unrelated button accidentally.

The usage of this function and the documentation seems a little bit unclear. Maybe it's just me. Anyway, thank you for your time!