How to change a button back to DrawMode normal?

Godot Version

4.1.3

Resolved

Godot buttons are Focused by default. I obtained the desired behavior by changing the Focus Mode on the button to NONE

Question

I have a button with a custom theme. The theme defines a normal, pressed, hovered, disabled setting and I can see that when I hover or press my button the state changes to the desired theme setting. However, after I’ve pressed the button will not return to Normal mode until I click another button.

I want to change my button back to DrawMode normal on the button_up signal, but there doesn’t seem to be any documentation surrounding this. I’ve also trying changing the button state manually using button_pressed = false and asking to queue_redraw()

I simply want the button to return to normal state after it’s been pressed but I haven’t been able to locate any documentation surrounding this pretty basic functionality. Any helpers?

This is likely related to the button node configuration rather than code control because I’m somewhat familiar with this situation. Please show the inspector view when selecting the button.

1 Like

As it turns out, I didn’t realize Godot buttons were focused by default. I was able to get the desired effect by setting the FocusMode to NONE. Whoops! Probably I setting I will want to enable for my user at some point, but for now I don’t like the always focused buttons

It’s best to leave focus mode to “All”, since you may plan to support devices that don’t have a mouse but a joystick input etc. I think you could set the focus style box to something like a border highlight to prevent this.

I don’t have this problem right now for my project, even the button focus mode is ALL. This might be a version issue and has been fixed in a higher version that I’m using, which is v4.2.2.stable.official [15073afe3].

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.