-
Notifications
You must be signed in to change notification settings - Fork 8
Description
- Godot version: 4.3 Stable
- NativeDialogs version: v2.2.1
When calling native_file_dialog.show(), the built-in Windows file selection dialog opens as expected. However, if native_file_dialog.show() is called again while the dialog is still open, the program hangs until the current file dialog is closed. Once the dialog is closed, the new file dialog immediately opens, and the program resumes normal operation.
This behavior causes the program to freeze when multiple calls are made to open the file dialog, which forces developers to add extra code to check if a dialog is already open, leading to unnecessary complexity and inconvenience, ultimately degrading the developer experience.
Proposal: Focus the already opened file dialog when calling native_file_dialog.show() again while it's still open
Instead of the program hanging and opening a new dialog after the current one is closed, I propose that if show() is called again while a file dialog is already open, the existing dialog should be brought to the front and focused. This will prevent multiple dialogs and enhance the user experience.
var native_file_dialog := NativeFileDialog.new()
func _ready():
native_file_dialog.file_mode = NativeFileDialog.FILE_MODE_OPEN_FILE
native_file_dialog.file_selected.connect(_file_selected)
add_child(native_file_dialog)
func _on_open_button_pressed(): # my signal from Button
native_file_dialog.show() # you can click twice
func _file_selected(path: String):
print("path: ", path)