Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to title file dialogs via Title field #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Internal/UI/Dialog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,14 @@ function Dialog.FileDialog(Options)
Options.AllowMultiSelect = Options.AllowMultiSelect == nil and true or Options.AllowMultiSelect
Options.Directory = Options.Directory == nil and nil or Options.Directory
Options.Type = Options.Type == nil and 'openfile' or Options.Type
Options.Title = Options.Title == "File dialog" or Options.Title
Options.Filters = Options.Filters == nil and {{"*.*", "All Files"}} or Options.Filters

local Title = "Open File"
if Options.Type == 'savefile' then
Options.AllowMultiSelect = false
Title = "Save File"
if not Options.Title then Options.Title = "Save File" end
elseif Options.Type == 'opendirectory' then
Title = "Open Directory"
if not Options.Title then Options.Title = "Open Directory" end
end

local Result = {Button = "", Files = {}}
Expand All @@ -426,7 +426,7 @@ function Dialog.FileDialog(Options)
local W = love.graphics.getWidth() * 0.65
local H = love.graphics.getHeight() * 0.65
if Dialog.Begin('FileDialog', {
Title = Title,
Title = Options.Title,
AutoSizeWindow = false,
W = W,
H = H,
Expand Down