Page 27 of 41

Re: Löve Frames - A GUI Library

Posted: Fri Dec 12, 2014 8:08 pm
by Nikolai Resokav
fmra wrote:I'm trying to retrieve the name of an object using GetHoverObject, but having iterated through the table it returns, the names I gave the objects do not exist. Closest I get is "instance of class loveframes_object_imagebutton" or similar. I'm trying to retrieve the name to match it against a table value (the objects name). See "obj[x]"

Code: Select all

if loveframes.util.GetHoverObject() then
  obj = loveframes.util.GetHoverObject()
  for k, v in ipairs(tbl) do
    if obj[x] == v then
      ...
    end
  end
end
How are you assigning the names of the objects?

Re: Löve Frames - A GUI Library

Posted: Fri Dec 12, 2014 8:27 pm
by fmra
oObjectName = loveframes.Create("___")

Since the objects are all created by the time it checks and are all listed in the table I'm referencing by these names, I thought it should work.

I'm hoping to be able to compare the string name for the object, retrieved by :GetHoverObject(), and the string name saved in my table.

Re: Löve Frames - A GUI Library

Posted: Sun Dec 14, 2014 12:52 am
by Nikolai Resokav
fmra wrote:oObjectName = loveframes.Create("___")

Since the objects are all created by the time it checks and are all listed in the table I'm referencing by these names, I thought it should work.

I'm hoping to be able to compare the string name for the object, retrieved by :GetHoverObject(), and the string name saved in my table.
That doesn't assign a name to the object itself, try doing something like this instead:

Code: Select all

local object = loveframes.Create("button")
object.name = "New Button"

Re: Löve Frames - A GUI Library

Posted: Sun Dec 14, 2014 8:29 pm
by Piggles
Really awesome library, thanks for your hard work. I'm wondering if there is a way to add a tooltip to an arbitrary area of the screen? Basically I have a grid of images and I would like to add a tooltip to each one, but I can't seem to do it without covering the image with a parent frame:

Image Image

I tried SetVisible(false) on the frame, but that hides the tooltip too. Any hints would be much appreciated!

Re: Löve Frames - A GUI Library

Posted: Sun Dec 14, 2014 8:50 pm
by Nikolai Resokav
Piggles wrote:Really awesome library, thanks for your hard work. I'm wondering if there is a way to add a tooltip to an arbitrary area of the screen? Basically I have a grid of images and I would like to add a tooltip to each one, but I can't seem to do it without covering the image with a parent frame:

Image Image

I tried SetVisible(false) on the frame, but that hides the tooltip too. Any hints would be much appreciated!
You can make the objects invisible by setting a custom drawing function without any drawing code:

Code: Select all

local frame = loveframes.Create("frame")
frame.Draw = function() end

Re: Löve Frames - A GUI Library

Posted: Sun Dec 14, 2014 9:05 pm
by Piggles
Nikolai Resokav wrote:
Piggles wrote:Really awesome library, thanks for your hard work. I'm wondering if there is a way to add a tooltip to an arbitrary area of the screen? Basically I have a grid of images and I would like to add a tooltip to each one, but I can't seem to do it without covering the image with a parent frame:

I tried SetVisible(false) on the frame, but that hides the tooltip too. Any hints would be much appreciated!
You can make the objects invisible by setting a custom drawing function without any drawing code:

Code: Select all

local frame = loveframes.Create("frame")
frame.Draw = function() end
That worked perfectly, thank you very much :)

Re: Löve Frames - A GUI Library

Posted: Tue Dec 16, 2014 2:53 pm
by Muris
I tried to use the gui for android, and it seems to work pretty well after setting love.setTextInput(true) when textinputfield gains focus, to get the virtual keyboard up, and then set it to false after clicking enter.

The problem that I noticed, I guess you could kind of call it a feature is with buttons. With Android since there is no visible cursor so the button needs to be clicked twice. First click is to set it as "hovered" -state because thats when the mousecursor moves from last spot, and second click to actually accept the click. I could be wrong with my analyzing, didn't look too deeply in the code, but from visual appearance thats what I think is happening. Also dragging finger across the screen to on top of the button to set the mouse coordinates on top of it first and then clicking it once seems to work instead of having to double click, so I suppose this further proves that the culpirit is the hovering feature.

Another issue that I noticed, or more likely just missed something in docs, is that frames text size cannot be changed.
Seems that I can describe frames fonts and buttons fons through skins.

Re: Löve Frames - A GUI Library

Posted: Mon Dec 22, 2014 7:28 pm
by vekenti
-Edit-

Does this not work with Love 0.91? it gives me some attempted to call 'NewObject'(a nil value) error coming from loveframes/objects/base

Re: Löve Frames - A GUI Library

Posted: Mon Dec 22, 2014 10:03 pm
by Nikolai Resokav
vekenti wrote:-Edit-

Does this not work with Love 0.91? it gives me some attempted to call 'NewObject'(a nil value) error coming from loveframes/objects/base
Make sure you are doing require("path.to.loveframes") and not require("path/to/loveframes").

Re: Löve Frames - A GUI Library

Posted: Mon Dec 22, 2014 10:18 pm
by vekenti
Make sure you are doing require("path.to.loveframes") and not require("path/to/loveframes").[/quote]

Wow didnt know that would make a difference o.o thanks

-Edit- Got a different error now,says that

Code: Select all

attempt to index global 'loveframes' (a nil value)
in function 'load'
-Edit -

forgot to do loveframes = require(blabla) fixed now