Buttons inside a Popup not responding to signals

DaveTheCoderDaveTheCoder Posts: 237Member

Is there some reason why a Button in a Popup would not receive a pressed() signal? Is there something different about such a button?

I have a Popup containing three Buttons.

A fourth Button outside the Popup uses its pressed() signal to activate the Popup. That works.
But none of the Buttons inside the Popup respond to their pressed() signals.

All four Buttons are connected to the Popup node via the pressed() signal, using a signal parameter button_id to identify them. There's a print statement at the beginning of the signal handling function to show that it was called, and to display the button_id.

Best Answer

  • DaveTheCoderDaveTheCoder Posts: 237
    edited January 28 Accepted Answer

    Issue resolved.

    The problem was that Popup was smaller than ColorRect and offset from it, so the buttons were not inside it.

    I figured this out when I was setting up a minimal project to duplicate the problem. I wanted to keep the relevant nodes the same, so I looked at their dimensions and noticed the odd position and size of Popup.

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 4,292Admin

    Is the button being pressed visually? Also, just to make sure, there I would check to see if there are any Control-based nodes overlapping the buttons that has the mouse filter on a mode that would stop the mouse. Especially if the buttons outside of the popup are working, I have a hunch something is stopping it from detecting the mouse click correctly in the popup.
    Maybe the popup itself blocks the mouse? I would check its mouse filter too, just to be sure.

  • DaveTheCoderDaveTheCoder Posts: 237Member
    edited January 28

    Here's the structure for the Popup:

    Popup
    .... ColorRect (popup background, encloses buttons)
    .... Button
    .... Button
    .... Button

    I just changed Control >> Mouse >>Filter to Pass for both Popup and ColorRect. It was previously Stop. This had no effect.

    There's no indication that the buttons are being pressed. The buttons' background color changes from normal to hover when the mouse moves over them, but the color does not change to pressed when clicked, as it does for other buttons that work.

    Debugger >> Misc >> Clicked Control does not indicate a click, as it does for other buttons.

  • DaveTheCoderDaveTheCoder Posts: 237Member
    edited January 28 Accepted Answer

    Issue resolved.

    The problem was that Popup was smaller than ColorRect and offset from it, so the buttons were not inside it.

    I figured this out when I was setting up a minimal project to duplicate the problem. I wanted to keep the relevant nodes the same, so I looked at their dimensions and noticed the odd position and size of Popup.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file