PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/script_binding/lua/demo4.lua

http://ftk.googlecode.com/
Lua | 41 lines | 30 code | 11 blank | 0 comment | 0 complexity | f5fa3ad743a59a386be60cc66d79b767 MD5 | raw file
 1xml=[[
 2<?xml version="1.0" encoding="utf-8"?>
 3<window value="Entry Label">
 4	<label  id="1" x="5" y="5" w="$ww/4" h="30" value="Name" />
 5	<entry  id="2" x="$ww/4+5" y="5" w="3*$ww/4-15" h="30" value="Li XianJing" />
 6	
 7	<label  id="3" x="5" y="40" w="$ww/4" h="30" value="EMail" />
 8	<entry  id="4" x="$ww/4+5" y="40" w="3*$ww/4-15" h="30" value="xianjimli@hotmail.com" />
 9	
10	<label  id="5" x="5" y="75" w="$ww/4" h="30" value="Mobile" />
11	<entry  id="6" x="$ww/4+5" y="75" w="3*$ww/4-15" h="30" value="+8613911112222" />
12	
13	<button id="99" x="5" y="3*$wh/4" w="$ww/2-5" h="50" value="Save" />
14	<button id="100" x="$ww/2" y="3*$wh/4" w="$ww/2-5" h="50" attr="$FTK_ATTR_FOCUSED" value="Quit" />
15</window>
16]]
17
18function OnQuit(button)
19	ftk_quit()
20	print(button:GetText() .. " Clicked.")
21	return RET_OK
22end
23
24function OnSave(button)
25	print(button:GetText() .. " Clicked.")
26	return RET_OK
27end
28
29Ftk.Init(1, {"demo4"})
30win=FtkXul.Load(xml, #xml)
31
32button = win:Lookup(99)
33FtkButton.SetClickedListener(button, "OnSave")
34
35button=win:Lookup(100)
36FtkButton.SetClickedListener(button, "OnQuit")
37
38win:ShowAll(1)
39Ftk.Run()
40
41