|
发表于 2010-11-28 14:32:12
|
显示全部楼层
应你的要求,把上面例子的代码发出来。
希望对你有帮助。
-
- function iup_tabs_test()
- assert (package.loadlib ("iuplua51.dll", "luaopen_iuplua")) ()
- --assert (package.loadlib ("iupluaole51.dll", "luaopen_iupluaole")) ()
- assert (package.loadlib ("iupluacontrols51.dll", "luaopen_iupluacontrols")) ()
-
- -- Creates boxes
- vbox1 = iup.vbox{
- iup.fill{},
- iup.button{title = "NW", size = "35x35", action = "direction_nw()"},
- iup.button{title="W", size = "35x35", action = "direction_w()"},
- iup.button{title="SW", size = "35x35", action = "direction_sw()"},
- iup.fill{} ;
- gap = 12,
- }
- vbox2 = iup.vbox{
- iup.button{title = "Up", size = "30x20", action = "direction_up()"},
- iup.button{title = "N", size = "35x35", action = "direction_n()"},
- iup.button{title="Enter", size = "30x20", action = "direction_enter()"},
- iup.button{title="Out", size = "30x20", action = "direction_out()"},
- iup.button{title="S", size = "35x35", action = "direction_s()"},
- iup.button{title = "Down", size = "30x20", action = "direction_down()"} ;
- alignment = "ACENTER", gap = 5,
- }
- vbox3 = iup.vbox{
- iup.fill{},
- iup.button{title = "NE", size = "35x35", action = "direction_ne()"},
- iup.button{title="E", size = "35x35", action = "direction_e()"},
- iup.button{title="SE", size = "35x35", action = "direction_se()"},
- iup.fill{} ;
- gap = 12,
- }
- vboxA = iup.hbox{vbox1, vbox2, vbox3}
- vboxB = iup.vbox{
- iup.label{title="此面板为空", expand="HORIZONTAL", alignment = "ACENTER"},
- iup.button{title = "空白按钮", expand="HORIZONTAL", alignment = "ACENTER"},
- }
-
- -- Sets titles of the vboxes
- vboxA.tabtitle = "行走"
- vboxB.tabtitle = "动作"
- -- Creates tabs
- tabs = iup.tabs{vboxA, vboxB}
- -- Creates dialog
- dlg = iup.dialog{iup.vbox{tabs; margin="10x10"}; title="行动面板", size="165x230", resize = "NO", menubox = "YES", maxbox = "NO", minbox = "NO" }
- -- Shows dialog
- dlg:showxy(iup.RIGHT, iup.CENTER)
- print("dialog's show is finished.")
- --MainLoop
- if (iup.MainLoopLevel()==0) then
- iup.MainLoop()
- end --if
-
- --以下代码,提供IUPLua从LUA中卸载的功能。
- dlg:destroy()
- iup.Close()
- print("IUPlua dialog is closed.")
- end -- iup_tabs_test()
- -- -- -- --
- function direction_nw()
- Send("nw")
- end --direction_nw()
- function direction_w()
- Send("w")
- end --direction_w()
- function direction_sw()
- Send("sw")
- end --direction_sw()
- function direction_up()
- Send("u")
- end --direction_sw()
- function direction_n()
- Send("n")
- end --direction_n()
- function direction_enter()
- Send("enter")
- end --direction_enter()
- function direction_out()
- Send("out")
- end --direction_out()
- function direction_s()
- Send("s")
- end --direction_s()
- function direction_down()
- Send("d")
- end --direction_d()
- function direction_ne()
- Send("ne")
- end --direction_ne()
- function direction_e()
- Send("e")
- end --direction_e()
- function direction_se()
- Send("se")
- end --direction_se()
复制代码 |
|