bugs in showMessageBox

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: bugs in showMessageBox

Post by zorg »

CherryBit wrote: Wed Feb 22, 2017 2:19 pm
Positive07 wrote: Wed Feb 22, 2017 1:45 pm Do you wanna save before quitting?
Yes / No / Cancel

[...]
Just to be pedantic: using "Yes"/"No" choices for dialogs is poor UX design and requires the user to read and think more. Using actions ("Save", "Don't Save") as the button labels is much clearer and allows the user to make choices with less reading. It may seem minor but users are easily frustrated, especially when you're forcing them to make a choice.
If you do want to be pedantic, then realize the choice is still there, you basically just hinted semantic sugar all over it; i'm truly sorry though, you thinking the current generation lacking the necessary capacity to understand a simple multiple-choice question with the most basic answer words.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
akt
Prole
Posts: 5
Joined: Wed Feb 01, 2017 9:30 pm

Re: bugs in showMessageBox

Post by akt »

Positive07 wrote: Wed Feb 22, 2017 1:45 pm Also there is lua-nativefiledialog which I have compiled and used fine with LÖVE.
Thanks for that info -- I'll give it a try. Do you have a working project or .love file I could download to see it in action?
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: bugs in showMessageBox

Post by Positive07 »

Nope, I have actually erased my dll... Not sure why. I should compile it again, it was pretty useful and nice. I need to recompile anyway since I have moved to a 64bits system since then
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
akt
Prole
Posts: 5
Joined: Wed Feb 01, 2017 9:30 pm

Re: bugs in showMessageBox

Post by akt »

Ok, I've got nativefiledialog working on my Macs (using LOVE 0.9.2 on Mac OS 10.6 and LOVE 0.10.2 on Mac OS 10.12). I had to fix a few bugs so I've put the resulting nfd.so on my website in case other folks want to use it. (It would be great if somebody could make their nfd.dll file available and save me the hassle of having to build it! hint hint...)

At the top of my main.lua file I do this:

Code: Select all

maindir = love.filesystem.getRealDirectory("main.lua")
if love.system.getOS() == "OS X" then
    package.cpath = maindir.."/nfd-mac/?.so;"..package.cpath
elseif love.system.getOS() == "Windows" then
    package.cpath = maindir.."/nfd-win/?.dll;"..package.cpath   -- TODO: build nfd.dll!!!
elseif love.system.getOS() == "Linux" then
    package.cpath = maindir.."/nfd-gtk/?.so;"..package.cpath    -- TODO: build nfd.so for GTK-3!!!
end

local nfd = require("nfd")      -- native open/save file dialogs

-- initial directory for nfd.open and nfd.save
initdir = love.filesystem.getSaveDirectory()
Then I call nfd.open like this:

Code: Select all

function OpenGame()
    -- let user open a previously saved game
    local filepath = nfd.open("cc", initdir)
    
    -- clear any keypressed events (happens on Mac OS 10.12)
    love.event.clear()

    if not filepath then
        return    -- user hit Cancel button
    end
    
    -- strip off filename and set initdir for the next nfd.open/nfd.save call
    initdir = filepath:gsub("[^/\\]+$","")

    ReadGame(filepath)
end
And nfd.save like this:

Code: Select all

function SaveGame()
    -- let user save the current game in a specified file and location
    local filepath = nfd.save("cc", initdir)
    
    --  clear any keypressed events (happens on Mac OS 10.12)
    love.event.clear()
    
    if not filepath then
        return false    -- user hit Cancel button
    end

    -- strip off filename and set initdir for the next nfd.open/nfd.save call
    initdir = filepath:gsub("[^/\\]+$","")

    WriteGame(filepath)
    return true
end
Note the need to call love.event.clear() to remove any keypressed events. Presumably due to the same Mac-specific bug that's in showMessageBox.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 64 guests