2021-06-10 07:53 PM
So assume we are at main screen, then triggered by an event we display an overlay which could be a user prompt. To close the prompt, we want to click anything outside this prompt area. Can we do this in TouchGFX?
Please note, the main screen could consist of multiple 'click listener' areas instead of one big chunk 'click' listener area. Obviously I can solve this by handing this in each of the click listener area, but this would be ugly. I am looking for a more elegant way.
2021-06-14 05:09 AM
Hi,
There are different ways to do this. What you could do for example is to have an empty "container widget" the size of the display, or of the zone you want to cover, that you initially set as invisible (so "untouchable") and set to visible when the overlay is displayed. The overlay has to be put "over" the custom container so that the zone outside of the overlay will correspond to the container and can trigger an action when clicked.
/Romain
2021-06-15 07:10 PM
Thank you @Romain DIELEMAN . What is the syntax to add overlay ontop of the empty container?
assume I have an object instance of empty "container widget" called overlayContainer. Then I have a overlay widget called overlaySlider to add on.
So is it like this:
ovelayContainer.add(overlaySlider) ?
And what do I need to do to cancel out the overlay? Is it overlayContainer.remove(overlaySlider)?
Is doing add() and remove() indicate dynamic memory allocation in this case?
2021-06-16 06:38 PM
Finally I manage to make it work, but I a concern over my implementation. I create I have several overlays to show depending on user action, and I put all these overlays widget inside a container, so it become cramped there. I wonder if there is better alternative to deal with multiple overlays.