PageRenderTime 243ms CodeModel.GetById 111ms app.highlight 3ms RepoModel.GetById 127ms app.codeStats 1ms

/script_binding/lua/demo_msgbox.lua

http://ftk.googlecode.com/
Lua | 62 lines | 46 code | 16 blank | 0 comment | 3 complexity | 6a45ec5b649be72062ad32f8c0086e58 MD5 | raw file
 1function OnTips(button)
 2	ret=Ftk.Tips("The dialog will quit in 3 seconds.");
 3	return RET_OK
 4end
 5
 6function OnWarning(button)
 7	ret=Ftk.Warning("Warning", 
 8	"December 31, 2008: patchwork.kernel.org is now available for general use. It is currently only monitoring the Linux Kernel mailing-list, but should be useful to kernel developers in dealing with patches flying across the wire.", 
 9	{"Yes", "No"})
10	print("Ret=" .. ret)
11
12	return RET_OK
13end
14
15function OnQuestion(button)
16	ret=Ftk.Question("Question", "Are you sure to quit?",  {"Yes", "No", "Help"})
17	print("Ret=" .. ret)
18	return RET_OK
19end
20
21function OnInfomation(button)
22	ret = Ftk.Infomation("Infomation", "September 19, 2008: mirrors.kernel.org has been flipped over to using our new GeoDNS based bind server (named-geodns). This means that, at the dns query level, our servers will attempt to direct you to the nearest / fastest kernel.org mirror for your request. This means that you no longer have to use mirrors.us.kernel.org or mirrors.eu.kernel.org to generally route you to the right place. This does mean a change to mirrors.kernel.org no longer explicitly pointing at mirrors.us.kernel.org. Additional information on named-geodns will be forth coming, check back here for an addendum soon.", {"OK"})
23	print("Ret=" .. ret)
24
25	return RET_OK
26end
27
28
29function AppInit()
30	win=FtkAppWindow.Create()
31	win:SetText("Demo messagebox")
32	win:SetAttr(FTK_ATTR_QUIT_WHEN_CLOSE)
33
34	width=win:Width()
35	height=win:Height()
36
37	button=FtkButton.Create(win, 0, height/6, width/3, 50)
38	button:SetText("Tips")
39	button:SetClickedListener("OnTips")
40
41	button=FtkButton.Create(win, 2*width/3, height/6, width/3, 50)
42	button:SetText("Warning")
43	button:SetClickedListener("OnWarning")
44
45	button=FtkButton.Create(win, 0, height/2, width/3, 50)
46	button:SetText("Question")
47	button:SetClickedListener("OnQuestion")
48
49	button=FtkButton.Create(win, 2*width/3, height/2, width/3, 50)
50	button:SetText("Infomation")
51	button:SetClickedListener("OnInfomation")
52
53	win:SetFocus(button)
54	win:ShowAll(1)
55
56	return 1
57end
58
59Ftk.Init(1, {"messagebox"})
60AppInit()
61Ftk.Run()
62