Closed frissyn closed 2 years ago
After reading through the docs more thoroughly and messing around bit more, it seems that FileDialog
can't be called inside an if slab.MenuItem(...) then
block because it will only be true for the duration of the click.
I've moved the FileDialog
call to love.update
, and the MenuItem("Open")
will set GUI.state.dialog.popOpen
to true
on user click, which solves my issue.
Really impressive library!
Glad you figured it out :) immediate mode UI can take a while to fully grasp how to do things around but once you get it, it'll be a breeze afterwards.
Thanks for the kind words :) credits to the original developer of this library
I'm using Menus and FileDialogs to create a
File > Open
functionality in the Main Menu (like Microsoft Word, Photoshop, etc.). A sample of the code looks this:Assuming that
slab.FileDialog
needs to be called every frame I need it open,GUI.state.dialog.popOpen
is set totrue
in thelove.load
function, and is only set tofalse
after the user has responded.This is adapted from the example given in the wiki, and while the
FileDialog
does open, it only stays open for a frame or two before closing. Any reason why this isn't working?