+3 votes

I am trying to rename my cars in my game and I am having trouble programatically closing the popup modal when the cancel button is clicked. Does anyone know of a proper way to close these things?
enter image description here

in Engine by (31 points)

2 Answers

0 votes

The ConfirmationDialog widget is the correct widget for what I was trying to do.

by (31 points)
+2 votes

I think you sould use ConfirmationDialog node for this case, just right click and clik change node type. ConfirmationDialog will automatically hide/closing when you click on the cancel button or close button.

But, if you prefer to use your own modal, try using signal for each button. For example you have cancle_btn node, and then use on_pressed() signal. That will be generate function like this

func _on_cancle_btn_is_pressed():

Replace passwith

if get_node(your_modal).is_visible():

Make sure your_modal is parent of cancle button, apply button, and other modal stuff.

by (35 points)
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 Frequently asked questions and 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 [email protected] with your username.