ddid
发表于 2010-11-24 00:01:57
这个是我用 IUPLua 做的一个面板。个人感觉,IUPLua应该可以完成与你写的那个wxLua面板相同的功能。
hqy
发表于 2010-11-24 12:25:28
好帖留名,以后有空了再来研究
ddid
发表于 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()
littleknife
发表于 2010-11-28 20:55:57
谢谢!基本能取代wxlua,很好的东西!!yct48 yct48
ddid
发表于 2010-11-28 21:37:07
呵呵~
nothank
inspector
发表于 2010-12-1 04:00:53
做按钮用mush自带的miniwindow跟hotspots就好了吧貌似,效果还很炫的,mush官方有详细教程。按钮有鼠标悬停鼠标滑过单击双击等各种反应动作,小窗口还能设置背景图片甚至有简单图像处理和合成的函数,Gammon那厮到底是作甚的...ttk_33
xspe
发表于 2012-3-24 22:01:36
努力学习中
flauto
发表于 2012-8-4 01:37:10
1.lua和python有不可比拟的优势。至少在跨平台上。不然我当时就是写pyhell,不是helllua乐。
jarlyyn 发表于 2010-11-23 03:56 PM http://pkuxkx.com/forum/images/common/back.gif
这句话何解? lua在跨平台上的优势真有那么大?
xkxyu
发表于 2014-4-8 15:51:12
学习一下