LoveUI for Love 0.5.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: LoveUI... has button, Textfield, scrollVIew

Post by appleide »

Ahh yes, I remember now.... What you could do is subclass LoveUI.Textfield.

Untested example code; Let's call it "TextBox"

Code: Select all

LoveUI.require("LoveUIControl.lua")
LoveUI.require("LoveUITextfieldCell.lua")
LoveUI.require("LoveUITextfield.lua")

TextBox=LoveUI.Textfield:new()
function TextBox:init(frame)
  LoveUI.Textfield.init(self, frame) -- must init super class!
  self.cell.value="MY CUSTOM VALUE";
  return self
end
function Textbox:becomeFirstResponder()
  LoveUI.Textfield.becomeFirstResponder(self) -- for super class
    self.cell.value = ""; -- clear it on focus.
end
Then, just create the textbox.

Code: Select all

TextBox:new(myframe)
aView:addSubview(TextBox)
It'll have a custom value "MY CUSTOM VALUE", when you focus on it, it'll clear the textfieldcell's value into "".
TextfieldCell handles more complicated behaviours of the textfield like selection and moving cursors; simple stuff is implemented inside the textfield itself.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LoveUI... has button, Textfield, scrollVIew

Post by Robin »

appleide wrote:TextfieldCell handles more complicated behaviours of the textfield like selection and moving cursors; simple stuff is implemented inside the textfield itself.
So TextieldCell is some sort of back-end for the Textfield class?
Help us help you: attach a .love.
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: LoveUI... has button, Textfield, scrollVIew

Post by appleide »

That is 100% correct.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: LoveUI... has button, Textfield, scrollVIew

Post by Sparx »

I think it would be great if someone who understands this whole thing would help appleide to write a documentation.
I löve documentations.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LoveUI... has button, Textfield, scrollVIew

Post by Robin »

I'd love to see some documentation for this as well. But I'm afraid the only one who understands LoveUI completely is appleide himself.
Help us help you: attach a .love.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: LoveUI... has button, Textfield, scrollVIew

Post by Sparx »

Robin wrote:I'd love to see some documentation for this as well. But I'm afraid the only one who understands LoveUI completely is appleide himself.
That's exactly why we need a documentation....
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: LoveUI... has button, Textfield, scrollVIew

Post by appleide »

You mean internal documentation? Rather than a user guide? I'll try.....
Meanwhile, take a look at ReadMe(Old).txt
It's old but still relevant. It explains the structure around which I've built things.

If you want to read the code in the most logical sequence, from back to front, start with this order:

LoveUI.lua -> LoveUIContext.lua -> LoveUI.View.lua -> LoveUIResponder.lua -> LoveUIControl.lua -> LoveUIButton.lua ->LoveUIActionCell.lua -> LoveUIButtonCell.lua

Which happens to be the order in which things were coded. (I actually bootstrapped the whole thing by building the first three files concurrently; but that's kinda irrelevant.) You can consider the first 3 files to be the central pillar which holds everything else in this lib together. LoveUIView.lua is the most interesting.

LoveUI.lua connects love to the library. LoveUIContext.lua connects input into the library. LoveUIView.lua connects every other widget to the library. Together, they become what you know as "LoveUI". You can remove every other widget, and LoveUIView will still be operational. (Although you need LoveUIStack.lua, LoveUIRect.lua, LoveUISize.lua, LoveUIPoint.lua, LoveUIResponder.lua, LoveUIEvent.lua and LoveUIGraphicsEnvironment.lua as support... These files are object-oriented versions of what already exists in lua and love itself.)
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LoveUI... has button, Textfield, scrollVIew

Post by Robin »

That readme file helped a little (at least for me), but I'm still a bit confused about how to use it. I'll dive into it later. I hope Sparx works it out as well.
Help us help you: attach a .love.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: LoveUI... has button, Textfield, scrollVIew

Post by Sparx »

just as far as I need it for my projects =)

I figured out how to use the tableview and buttons, till jet thats all i need.
But i think there might be more elegant ways to use a GUI:

in the draw function should be just: drawGUI
and in the update: updategui(dt)

and for the rest all the elements should be set by functions.. which seems more difficult in LoveUI... I'm still using it since it's quite functional and looks nice.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: LoveUI... has button, Textfield, scrollVIew

Post by Sparx »

The more I use "TableView:reloadData()" the more it has speed problems afterwards (scrolling, sorting etc), even the buttons react more slow after having used reloadData(or clicking the headers to sort the tabel) for about 20 times...
Found out its directly influencing my FPS.

If i hide the table, speed is back to normal.

I don't see any reason why it should be like that, besides that the table performance itself is quite poor. I love the table, so i hope a solution is following..
Post Reply

Who is online

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