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
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.
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?
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:
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.)
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.
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.
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..