![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | AmusedBored |
I’m trying to have a dialog that either opens an existing directory or creates a specially named directory for my data repository. To do this, I’m using a FileDialog with directory settings and then adding another button for “Create New”. Unfortunately, the custom_action signal is not called when the button is pressed. Here is my reduced example.
extends Control
onready var open = $OpenDialog
func _ready():
open.popup_centered()
open.mode = FileDialog.MODE_OPEN_DIR
open.set_access(FileDialog.ACCESS_FILESYSTEM)
open.get_line_edit().set_visible(false);
open.window_title = "Open or Create a Repository"
func _on_OpenDialog_ready():
$OpenDialog.add_button("Create New", true)
func _on_OpenDialog_custom_action(action):
print("Create new at "+open.current_path)
open.hide()
func _on_OpenDialog_dir_selected(dir):
print("Selected "+dir)
func _on_OpenDialog_confirmed():
print("Confirmed")
This is attached to the Startup scene and the signals attached to the functions above. I can open an existing directory with no problems but the Create New button is non-responsive. I’m very very new to Godot so probably just missing something.