Re: Re: list with 2 colums
Hello list!
Well, using Morten sugestion, I created dinamicly "gui.list" for each colum
of data in my matix, table ... The code is here, for each colum I set a y
position, and so is like a grid.
-- tool to easy display multi colums data using Plua
function eventsHandler(e, id, arg)
--print("e"..e.." id"..id.."arg"..arg)
-- incredible bad code here !
-- dont make this in your house please :)
gui.setstate(1800,arg)
gui.setstate(1801,arg)
gui.setstate(1802,arg)
end
function datagrid(data,lines,colums,height,widthColums)
d={}
x = 0
for j=1, colums do
for i=1, lines do
d[i] = data[i][j]
end
screen.moveto(x)
x = x + (widthColums[j]*5) +1
list = gui.list(height,widthColums[j],d)
gui.sethandler(list,eventsHandler)
end
end
-- testing ------------------------------------
mydata = {}
for a=1,30 do
mydata[a] = {}
mydata[a][1] = a;
mydata[a][2] = "description "..a;
mydata[a][3] = "value "..a;
end
screen.moveto(0,30)
gui.title("Data grid with >= 2 colums")
widthColums = {}
widthColums[1] = 5
widthColums[2] = 18
widthColums[3] = 8
-- data, lines,colums, height, width for each colum of matrix
datagrid(mydata,30,3,12,widthColums)
gui.main()
So it works fine, but I not like the number of "for" loops, that is so
"hard" to fragile device process... that's work, but I don't like this.
Ps.: My palm is a Palm Z22, 160x160 px screen, 200MHZ processor
Bye friends, and thanks for ideas, if are more ... please report.
[Non-text portions of this message have been removed]