Menu button is drawn as pressed when the menu is shown

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

In my project I have a ButtonGroup with a few buttons, which is meant to be controlled via controller (not keyboard). The button group is in a node that is shown / hidden upon button press.

In order to make the menu buttons react to controller input, upon showing the button group, I also grab focus for one of them using
$"pause menu/btn_exit".grab_focus()

So this works great, when the menu buttons show up on the screen I can press up / down and the appropriate button is highlighted, I can easily keep track of which button I’m currently on etc.

The problem is that the first button always looks pressed when I summon the menu, despite me scanning all the buttons in a group with
if btn.is_pressed ( ) == true : btn.set_pressed(false)
but this doesn’t do anything… But as soon as I move the cursor away from the first button I can see on the screen that the button is using the “pressed” theme setting.

And just to confirm, I did make sure that the buttons are unpressed and set to Toggle Mode.
image

Why is one of the buttons always marked as pressed in the beginning? And how can I turn the “pressed” state of the buttons in the menu off?

I think I found out why, the default ui control for ui_accept is set to the same button I used for summoning the menu. So what was happening was that the menu would get summoned and then the same button press would have been grabbed by the button too (which would mark it as pressed).

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