On this page
Example Window
Example Implementation using some of the new toolkits in 10.0.4
local DEFAULTS = {
X = -1,
Y = -1,
WIDTH = -1,
HEIGHT = -1,
BORDER_SIZE = 0
}
local windowRowSizer = UIRowLayoutSizer.new()
local window = UIWindow.new(windowRowSizer, "Title", true, false)
-- Rows in Window
local bgSizer = UIRowLayoutSizer.new()
local panel = UIPanel.new(windowRowSizer, bgSizer, DEFAULTS.X, DEFAULTS.Y, DEFAULTS.WIDTH, DEFAULTS.HEIGHT, BorderDirection.NONE, DEFAULTS.BORDER_SIZE, 1)
-- First Row
-- Border
local uiBorderSizer = UIRowLayoutSizer.new()
local panel = UIPanel.new(bgSizer, uiBorderSizer, -1, -1, -1, -1, BorderDirection.NONE, 0, 1)
panel:setBackgroundColor(1, 1, 1, 1)
-- Panel Title Content
local rowSizerElements = UIRowLayoutSizer.new()
UIPanel.new(uiBorderSizer, rowSizerElements, -1, -1, -1, -1, BorderDirection.ALL, 15, 1)
UILabel.new(rowSizerElements, "Blahdeblie", true, TextAlignment.LEFT, VerticalAlignment.TOP, DEFAULTS.X, DEFAULTS.Y, 400, DEFAULTS.HEIGHT, BorderDirection.BOTTOM, DEFAULTS.BORDER_SIZE, 1)
-- Notebook
local content = UIRowLayoutSizer.new()
local notebook = UINotebook.new(bgSizer, content, DEFAULTS.X, DEFAULTS.Y, 400, DEFAULTS.HEIGHT, BorderDirection.ALL, 15, 1)
-- Tab 1
local tab1 = UIGridSizer.new(1,1)
notebook:addTab("UITree", tab1)
local tree = UITree.new(tab1,"customRootNode",DEFAULTS.X,DEFAULTS.Y,250,DEFAULTS.HEIGHT)
tree:appendItem("Hello")
-- Tab 2
local tab2 = UIGridSizer.new(1,1)
notebook:addTab("UIFlowDiagram", tab2)
local flow = UIFlowDiagram.new(tab2,100,100,0,0,800,800)
local rootNode = flow:createNode()
flow:setNodeTitle(rootNode, "Map Name")
local farms = math.random(5)
for i=0,farms do
local farmNode = flow:createNode()
flow:setNodeTitle(farmNode, "Farm "..i)
local productions = math.random(7)
for j=0,productions do
local productionNode = flow:createNode()
flow:setNodeTitle(productionNode, "Production " .. i .. "-" .. j)
flow:linkNode(farmNode,productionNode)
local products = math.random(7)
for k=0,products do
local productNode = flow:createNode()
flow:setNodeTitle(productNode, "Product " .. i .. "-" .. j .. "-" .. k)
flow:setNodeText(productNode, "Some more text explaining about the product.")
flow:linkNode(productionNode,productNode)
end
end
flow:linkNode(rootNode,farmNode)
end
flow:layout()
-- Tab 3
local tab3 = UIGridSizer.new(1,1)
notebook:addTab("UIList", tab3)
local list = UIList.new(tab3,DEFAULTS.X,DEFAULTS.Y,250,DEFAULTS.HEIGHT)
for i=0,3 do
list:appendItem("Hello " .. i)
end
-- Tab 4
local tab4 = UIGridSizer.new(1,1)
notebook:addTab("UIRadioButton", tab4)
for j=0,math.random(3) do
UILabel.new(tab4, "Group " .. j)
UIRadioButton.new(tab4,"First Custom option ",true)
for i=0,math.random(5) do
UIRadioButton.new(tab4,"Custom " .. i,false)
end
UIHorizontalLine.new(tab4)
end
-- Tab 5
local tab5 = UIGridSizer.new(1,1)
notebook:addTab("UISlider", tab5)
local list = UISlider.new(tab5,420,69,666,DEFAULTS.X,DEFAULTS.Y,250,DEFAULTS.HEIGHT)
for i=0,5 do
local checkbox = UICheckBox.new(tab5, "Custom Check")
end
window:showWindow()
Last updated 12 Apr 2025, 16:14 +0200 .