+1 vote

I am using the fileDialog to load in an image.
The file list is always empty when I show it with $FileDialog.show() (http://ictbram.com/godotQuestions/emptyFileList01.png)
The user has to press the refresh button to make the files appear (http://ictbram.com/godotQuestions/emptyFileList02afterRefresh.png )
Is there a way to do this by code?

asked May 24, 2018 in Engine by ictbram (31 points)
edited May 24, 2018 by ictbram

2 Answers

+2 votes
Best answer

There is: overload _draw() of FileDialog

func _draw():
    set_current_dir( path )
answered May 24, 2018 by hilfazer (2,034 points)
selected May 24, 2018 by ictbram

ok, can this be done with gdscript? That's c++ probably? I meant, is there a way to do this by code with gdscript..

Sry, i meant "override". Actually, it is GDScript :)

aha thx, got it with a refresh function in extends FileDialog

func refresh(): 
    self._draw()

func _draw():
    set_current_dir( "res://" )
+1 vote

Just in case anyone still wonders : the correct of displaying a FileDialog (like any popup) is to call the popup() function :

in this case, instead of $FileDialog.show(), just call $FileDialog.popup()

answered Oct 23, 2019 by Cevantime (16 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 How to use this Q&A? before posting your first questions.