I’m using a custom Class the inherits from UCommonButtonBase.
I’m trying to create this behavior:
the button can be toggled
the button cannot be toggled by clicking it when it is selected
the button is only toggled when i call Set Is Selected from another Event.
What I found is that I need Toggleabe property set to True. Otherwise the Select/Deselect behavior doesn’t work.
HOWEVER, when the button is Selected, I can still click and deselect it. That’s not the behavior I want.
There is a property called ‘Interactable when Selected’ and in the comment we can see it is intended to avoid the button being clickable when it is Selected.
But it does not work.
I can still click and Deselect the button.
So, is this a bug or I’m not doing something right?
Your use of the word “click” makes it sound like this is a mouse-only interaction, correct?
If you don’t want the mouse to be able to click something, you can usually set its visibility to not hit testable. I’m not sure if the same options are available in Common UI widgets though.
Alternately, you can put an image on top of the button by using a higher Z order and then setting the alpha for the image’s color to 0 so it is completely invisible, but the player mouse is unable to click the button.
Hi Detach, thanks for the reply.
Yes it is mouse interaction. The Non Hit-Testable works as a work around.
Right now Im using a similar approach that is kinda trick. Im setting the buttons to Not Toggable.
When I want to deselect a button (from another event) I set the button to Toggable. Then I change the select state and set to Not Toggable again.
I’ll use your Non-Hit Testable idea. the blueprint for this will give me a much cleaner solutions. thanks
Undigging, because it’s the only thread I can find about it.
My Setup is: I have a row of buttons, and there can be only one selected at the same time, and at least one must be selected at any time. So basically when you select something, the currently selected one deselects, and you can’t deselect by clicking again.
Judging by the tooltips, the “InteractableWhenSelected” was what I was looking for as well, but it’s not working as op mentioned.
So I peeked inside the code and I don’t now why, but basically whenever 'Interactable when Selected’ is checked, it also checks if Toggleable (one option below) is unchecked… It might be a bug, it might be a feature, I’m not digging into it, but it makes InteractableWhenSelected useless if you want to have a Toggleable Button, but not interactable.
My solution is similar to schmigel’s first one (because “not hit testable trick” doesn’t work for me, and I’m not itching to investigate it).
Turn everything Toggleable, and set it to not toggleable when it’s selected. When you want to deselect it with BP just unset Toggleable right before it