-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_group.cr
More file actions
43 lines (34 loc) · 1.05 KB
/
basic_group.cr
File metadata and controls
43 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require "../../src/uing"
UIng.init
window = UIng::Window.new("Group Example", 300, 200, margined: true)
window.on_closing do
UIng.quit
true
end
group = UIng::Group.new("User Settings", margined: true)
box = UIng::Box.new(:vertical, padded: true)
# Enable notifications checkbox
notifications_checkbox = UIng::Checkbox.new("Enable notifications")
notifications_checkbox.checked = true
box.append(notifications_checkbox)
# Theme selection radio buttons
theme_radio = UIng::RadioButtons.new
theme_radio.append("Light")
theme_radio.append("Dark")
theme_radio.append("Auto")
theme_radio.selected = 0
box.append(theme_radio)
# Save button
save_button = UIng::Button.new("Save Settings")
save_button.on_clicked do
notifications = notifications_checkbox.checked? ? "enabled" : "disabled"
theme_options = ["Light", "Dark", "Auto"]
theme = theme_options[theme_radio.selected]
window.msg_box("Settings Saved", "Notifications: #{notifications}\nTheme: #{theme}")
end
box.append(save_button)
group.child = box
window.child = group
window.show
UIng.main
UIng.uninit