Chili
Chili UI
ChiliUi is a framework still in development by author JK. It's a very flexible class based framework, with it's structure derived from Delphi. It has most of the basic components you expect a framework like for example Swing in jawa must have. It might feel a bit daunting at first to get started but with a little reverse engineering and this tutorial page you'll get a long way !
Getting Chili
Download it , and put the extracted files in LuaUi/widgets. It should run out of the box, but user experiences have been conflicted on that. If you are in trouble getting Chili to run, I advice to login to the lobby and join /j moddev. People there will help you figure it out. I could write something here, but by the time it's written , someone else probably has another problem installing it !
Chili Component Hiearchy
object |_font |_screen |_control |_button |_image |_checkbox |_colorbars |_label |_layoutpanel |_imagelistview |_grid |_stackpanel |_treeview |_panel |_progressbar |_scrollpanel |_textbox |_trackbar |_treeview |_treeviewnode |_window
Hello World
As in every first baby steps in a framework we are going to get hello world to work. First we are going to need to make a script file in the widgets directory. It's usually a good idea to keep the chili implemented files seperate from the other script files in naming convention.
Create a file gui_chili_helloworld.lua and copy following basic structure.
-- INCLUDES -- CONSTANTS -- SYNCED CONTROLS -- CHILI CONTROLS -- MEMBERS -- SCRIPT FUNCTIONS -- WIDGET CODE
As in every widget code you will need the basic info part telling about the widget. Who made it what it serves for and who the author is etc... Next you will also need the code for initializing the widget. For this example, we are going to need a few Chili controls. We have need for the Chili, Window and Label control. That makes the script look like this now.
-- INCLUDES -- CONSTANTS -- SYNCED CONTROLS -- CHILI CONTROLS local Chili local Window local Label
-- MEMBERS -- SCRIPT FUNCTIONS -- WIDGET CODE function widget:GetInfo()
return { name = "helloworld", desc = "hello world tutorial", author = "Sunspot", date = "2011-06-19", license = "GNU GPL v2", layer = 1, enabled = true }
end
function widget:Initialize()
if (not WG.Chili) then widgetHandler:RemoveWidget() return end
Chili = WG.Chili Window = Chili.Window Label = Chili.Label
local screen0 = Chili.Screen0
end