Skip to main content
MLook.1
Associate II
April 8, 2021
Solved

If I place a box on top of a button, I can still click the button, how do I stop this?

  • April 8, 2021
  • 4 replies
  • 1428 views

I would expect obscured controls to not respond to clicks.

This topic has been closed for replies.
Best answer by Romain DIELEMAN

What I do usually is to add an empty container widget and enable the ClickListener ability in the setting tabs of the widget under "mixin". When I want the buttons to be clickable again I set the container to "non visible" in code. I'll attach an example I gave recently to another user if someone else finds this post in the future and wants another solution.

/Romain

4 replies

Sergey Bogaev
Associate
April 8, 2021

If I just need to deactivate the button, I use button.isToucheble (false) and make it more transparent with button.setAlpha (x)

In my experience only modal window obscures other widgets. I have not been able to make a modal window of custom size to obscure only certain widgets on the screen. However, it is possible to put those widgets and/or modal window in a separate container and then add it to the screen.

MLook.1
MLook.1Author
Associate II
April 8, 2021

Thanks, unfortunately there are a whole load of buttons under the box that I want to prevent being clicked (I'm kind of doing a modal thing). I've come up with a kludge where from back to front I have buttons I don't want activated, a big blocking button that fills the screen, buttons I do want activated. The big blocking button is a flexButton with only a text element and the text is a space so it is invisible and invisibly consumes any clicks that would pass through to the buttons below.

Romain DIELEMAN
Romain DIELEMANBest answer
ST Employee
April 9, 2021

What I do usually is to add an empty container widget and enable the ClickListener ability in the setting tabs of the widget under "mixin". When I want the buttons to be clickable again I set the container to "non visible" in code. I'll attach an example I gave recently to another user if someone else finds this post in the future and wants another solution.

/Romain

userRobert
Associate
April 8, 2021

In MIXINS for Box check "ClickListener" to add event and do not implement.