PageRenderTime 72ms CodeModel.GetById 30ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 0ms

/script_binding/lua/demo_wait_box.lua

http://ftk.googlecode.com/
Lua | 54 lines | 39 code | 15 blank | 0 comment | 0 complexity | a6459a6e9c55cd00ba766cf6d433eb46 MD5 | raw file
 1function OnQuit(button)
 2	print("OnQuit: " .. button:GetText())
 3	Ftk.Quit()
 4
 5	return RET_OK
 6end
 7
 8function OnStart(button)
 9	wait_box=button:Toplevel():Lookup(1)
10	wait_box:StartWaiting()
11
12	return RET_OK
13end
14
15function OnStop(button)
16	wait_box=button:Toplevel():Lookup(1)
17	wait_box:StopWaiting()
18
19	return RET_OK
20end
21
22function AppInit()
23	win=FtkAppWindow.Create()
24	win:SetAttr(FTK_ATTR_QUIT_WHEN_CLOSE)
25	win:SetText("Demo waitbox")
26
27	width=win:Width()
28	height=win:Height()
29
30	wait_box=FtkWaitBox.Create(win, width/2 - 16, height/4)
31	wait_box:SetId(1)
32
33	button=FtkButton.Create(win, 0, height/2, width/3, 50)
34	button:SetText("Start")
35	button:SetClickedListener("OnStart")
36
37	button=FtkButton.Create(win, 2*width/3, height/2, width/3, 50)
38	button:SetText("Stop")
39	button:SetClickedListener("OnStop")
40	
41	button=FtkButton.Create(win, width/4, 3*height/4, width/2, 60)
42	button:SetText("Quit")
43	button:SetClickedListener("OnQuit")
44
45	win:SetFocus(button)
46	win:ShowAll(1)
47
48	return 1
49end
50
51Ftk.Init(1, {"waitbox"})
52AppInit()
53Ftk.Run()
54