Closing a popup

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bkeys
:warning: Old Version Published before Godot 3 was released.

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?

:bust_in_silhouette: Reply From: bkeys

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

:bust_in_silhouette: Reply From: Andika Satya Wisnu

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.