0 votes

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

$Button.setkeeppressed__outside(true)

is working only while mouse is still pressed.

in Engine by (96 points)

1 Answer

0 votes

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...

by (12,475 points)

I try to make pause/play button. If the button is pressed, it has got another icon than if it is unpressed.

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...

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

I solved it so:

$Pause.DRAWHOVERPRESSED

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.