PageRenderTime 314ms CodeModel.GetById 161ms app.highlight 4ms RepoModel.GetById 147ms app.codeStats 1ms

/script_binding/lua/demo_check_button.lua

http://ftk.googlecode.com/
Lua | 63 lines | 48 code | 15 blank | 0 comment | 0 complexity | 40858e2cd05ab89e0f13e763fd7adde1 MD5 | raw file
 1function OnQuit(button)
 2	Ftk.Quit()
 3
 4	return RET_OK
 5end
 6
 7function OnClicked(button)
 8	print("OnClicked")
 9	return RET_OK
10end
11
12function AppInit()
13	win=FtkAppWindow.Create()
14	win:SetAttr(FTK_ATTR_QUIT_WHEN_CLOSE)
15	win:SetText("Demo check button")
16
17	width=win:Width()
18	height=win:Height()
19
20	width = width/2 - 10;
21	button=FtkCheckButton.Create(win, 0, 10, width, 50)
22	button:SetText("show")
23	button:SetClickedListener("OnClicked")
24
25	button=FtkCheckButton.Create(win, width + 10, 10, width, 50)
26	button:SetText("hide")
27	button:SetClickedListener("OnClicked")
28
29	group=FtkGroupBox.Create(win, 0, 60, 2 * width, 60)
30	button=FtkCheckButton.CreateRadio(group, 0, 10, width, 50);
31	button:SetText("Male")
32	button:SetClickedListener("OnClicked")
33
34	button=FtkCheckButton.CreateRadio(group, width + 10, 10, width, 50)
35	button:SetText("Female")
36	button:SetClickedListener("OnClicked")
37
38	group=FtkGroupBox.Create(win, 0, 120, 2 * width, 60)
39	button=FtkCheckButton.CreateRadio(group,0, 10, width, 50)
40	button:SetText("1(???)")
41	button:SetIconPosition(1)
42	button:SetClickedListener("OnClicked")
43
44	button=FtkCheckButton.CreateRadio(group, width + 10, 10, width, 50)
45	button:SetText("2(???)")
46	button:SetIconPosition(1)
47	button:SetClickedListener("OnClicked")
48
49	button=FtkButton.Create(win, width/2, 3*height/4, width, 60)
50	button:SetText("Quit")
51	button:SetClickedListener("OnQuit")
52
53	win:SetText("check button demo")
54	win:SetFocus(button)
55	win:ShowAll(1)
56
57	return 1
58end
59
60Ftk.Init(1, {"checkbutton"})
61AppInit()
62Ftk.Run()
63