我试图弄清楚如何为矩阵单元格的背景着色,但测试代码不起作用。最后,我想用它来为矩阵的每一行着色以提高可读性。有人可以告诉我它有什么问题吗?
require( "iuplua" )
require( "iupluacontrols" )
mat = iup.matrix {numcol=5, numlin=3,numcol_visible=5, numlin_visible=3, widthdef=34, bgcolor="50, 255, 50"}
mat.resizematrix = "YES"
mat:setcell(0,0,"Inflation")
mat:setcell(1,0,"Medicine")
mat:setcell(2,0,"Food")
mat:setcell(3,0,"Energy")
mat:setcell(0,1,"January 2000")
mat:setcell(0,2,"February 2000")
mat:setcell(1,1,"5.6")
mat:setcell(2,1,"2.2")
mat:setcell(3,1,"7.2")
mat:setcell(1,2,"4.6")
mat:setcell(2,2,"1.3")
mat:setcell(3,2,"1.4")
mat.bgcolor = "50, 255, 50"
dlg = iup.dialog{iup.vbox{mat; margin="10x10"}}
dlg:showxy(iup.CENTER, iup.CENTER)
if (iup.MainLoopLevel()==0) then
iup.MainLoop()
end
我正在使用 Lua 5.1 和 IUP 3.5 来编辑一个旧程序,我检查了文档以确保我的版本可以使用这样的功能,并且看起来确实存在。