Skip to content

Commit 97e2e94

Browse files
committed
Added TabControl Element
Added ComboBox Element Added/Updated Switch Element Fixed TextBox Syntax Highlighting Bug
1 parent 775bd9e commit 97e2e94

5 files changed

Lines changed: 975 additions & 15 deletions

File tree

examples/TabControl.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local basalt = require("basalt")
2+
3+
local frame = basalt.getMainFrame()
4+
5+
local tabs = frame:addTabControl({x = 2,
6+
y = 2,
7+
width = 35,
8+
height = 12,
9+
headerBackground = colors.black,
10+
foreground = colors.lightGray
11+
})
12+
13+
14+
-- create three tabs; addTab now returns a proxy for adding elements into the new tab
15+
local overview = tabs:newTab("Overview")
16+
local editor = tabs:newTab("Editor")
17+
local settings = tabs:newTab("Settings")
18+
19+
-- Overview tab: add a label and a button
20+
overview:addLabel({x = 2, y = 2, width = 46}):setText("Welcome to the demo")
21+
overview:addButton({x = 2, y = 4, width = 12, height = 3}):setText("Click me")
22+
:setBackground("{self.clicked and colors.green or colors.black}")
23+
:setForeground("{self.clicked and colors.black or colors.lightGray}")
24+
25+
-- Editor tab: textbox with some sample text
26+
editor:addTextBox({x = 2, y = 2, width = 12, height = 8, background=colors.black, foreground=colors.white}):setText("Type here...\nLine 2\nLine 3")
27+
28+
-- Settings tab: show some inputs
29+
settings:addLabel({x = 2, y = 2, width = 20}):setText("Settings")
30+
settings:addLabel({x = 2, y = 4, width = 20}):setText("Username:")
31+
settings:addLabel({x = 2, y = 6, width = 20}):setText("Password:")
32+
settings:addInput({x = 12, y = 4, width = 20, background=colors.black, foreground=colors.white})
33+
settings:addInput({x = 12, y = 6, width = 20, background=colors.black, foreground=colors.white})
34+
35+
basalt.run()

0 commit comments

Comments
 (0)