Basic UI Component

I needed some basic UI components in a prototype I was messing about with and figured they may be helpful to someone else. I have named it Lime (because who doesn’t like some Lime with their Corona?).

Currently it only has simple implementations of checkboxes, radio buttons, toggle buttons and progress bars. As I say they are very basic as this is all that I needed for this prototype however I plan to add more components and features to it over time.

You can download it from here - http://www.monkeydead.com/domains/grahamranson/downloads/libs/lime/Lime-0.1.zip

When I’ve finished updating my portfolio site it will be placed on there.

Very simple to use:

  
-- Include Lime and instantiate it.  
local lime = require("lime").new()  
  
-- Create a checkbox  
local checkBox = lime:createComponent("checkbox", {x=50, y=100})  
  
-- Create a new GroupBox  
local groupBox1 = lime:createComponent("groupbox")  
  
-- Create two RadioButtons  
local radioButton1 = lime:createComponent("radiobutton", {x=50, y=150, isSelected=true})  
local radioButton2 = lime:createComponent("radiobutton", {x=100, y=150})  
  
local onUpdate = function(event)  
 -- Update lime, this needs to be done to update all running components  
 lime:update()   
  
end  
  
Runtime:addEventListener("enterFrame", onUpdate)  
  

When the checkbox is selected or unselected the event that is fired is called: checkboxChecked
Radio button event: radiobuttonSelected
Toggle button event: togglebuttonSelected

All these events have an event.component parameter as well as a event.selected or event.checked

Any questions, comments or feedback please just reply here as I’m sure there is more I need to explain and hopefully I will find some time to add more to it.

Graham [import]uid: 5833 topic_id: 1928 reply_id: 301928[/import]