How to make the button stay (visually) pressed?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By

How to make the button stay pressed (visually it is enough), even if the mouse is no longer pressing and touching it?


is working only while mouse is still pressed.

:bust_in_silhouette: Reply From: jgodfrey

You don’t say what you’re doing here, but maybe a CheckButton or CheckBox control would be more appropriate? Both will give you a specific, binary (on/off) state with expected visuals…

I try to make pause/play button. If the button is pressed, it has got another icon than if it is unpressed. | 2020-08-31 17:17

I still might recommend a CheckButton. In the inspector, you can supply custom icons for Off, On, and On Disabled states of the button. So, you can make it look like you want and it’ll give you explicit on/off state info…

jgodfrey | 2020-08-31 17:28

Likewise, you can assign custom icons to the various states of a CheckBox also.

jgodfrey | 2020-08-31 17:47

I solved it so:


but the thing with the CheckBoxes is good idea.
One more thing, I didn’t figure out how to remove the black square on the CheckBox. So it overlaps the icon I’m trying to place there. | 2020-09-01 08:59