cancel
Showing results for 
Search instead for 
Did you mean: 

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

MLook.1
Associate III

I would expect obscured controls to not respond to clicks.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4
Sergey Bogaev
Associate II

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
Associate III

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.

userRobert
Associate II

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

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