2019-11-20 11:28 PM
Hi
I have a CustomContainer (menuScreen) that opens when pressing the menu button on my taskbar.
In the MenuClickHandler function the menuScreen is added and the following container appears:
By pressing a button the screen is being changed. The problem is when pressing on the white background it could happen that an interaction is triggered (e.g. button pressed) from the screen behind this container.
How can I set the entire screen behind the container inactive or not touchable?
Is there maybe another solution?
Regards Dejan
2019-11-21 12:49 AM
try
/**
* @fn void Drawable::setTouchable(bool touch)
*
* @brief Controls whether this Drawable receives touch events or not.
*
* Controls whether this Drawable receives touch events or not.
*
* @param touch If true it will receive touch events, if false it will not.
*/
void setTouchable(bool touch);
2019-11-21 01:07 AM
Hi @Martin KJELDSEN
How can I get the current screen out of the container?
Regards Dejan
2019-11-21 01:15 AM
Did the above work?
You cannot get the current screen out of the container in an easy way, but you could construct your containers using some identifier and do it like that, if you really need the information.
/Martin
2019-11-21 01:49 AM
@Martin KJELDSEN
It didn't work with setTouchable.
Do you have an idea how to get rid off those unwanted touch interaction behind the container (on a screen view)?
Regards Dejan
2019-11-21 05:14 AM
I don't understand why setTouchable(false) doesn't work if you call that on the white background. Can you double check?
Or call setTouchable(false) on the buttons behind the container. When you show them (hide the container) set them touchable again.
/Martin
2019-11-21 06:33 AM
@Martin KJELDSEN
unfortunately it did not work with setTouchable(false) on the white background.
To call setTouchable(false) on the buttons behind the container is a lot of work, because the menu container can be shown from every screen in this touchgfx project.
Maybe it is easier when the menu is a screen instead of a custom container. If there is no easy way to avoid the touch interactions behind this container it's the only solution to go.
Regards Dejan
2019-11-21 06:47 AM
We're missing something, or i am, because z-order is respected, and if you have something covering the entire canvas that is not clickable, then elements beneath it will not receive touch events.
Maybe it's easier if you send the project.
/Martin
2019-11-21 06:58 AM
I've send you the project in a message.
I've added the TaskBar container to every screen and in the TaskBar.cpp I add the MenuScreen container when the menu button is pressed.
Regards Dejan
2019-11-29 12:30 AM
Hi @Martin KJELDSEN
Could you already look at it?
Regards
Dejan