Hi all,
I really like Cider. I had the need of a pretty table display and I made the following modest addition to cider. It can be used as a slightly more general multibutton or just as a display. It goes without saying that you can do whatever you want with it 
-- the toucharray class takes a string in the latex format rows separated by & and ---
-- columns by \\\\ and produces a touchable array whose topleft corner is is at x,y and whose
-- celsizes are either automatic or given by the user.
-- the typical call is a=touchArray("aaaaaaaa aaaa & b \\\\ c& d & t\\\\ a& 5&", 300,300, "single") or
-- a=touchArray("aaaaaaaa aaaa & b \\\\ c& d & t\\\\ a& 5&", 300,300, "single",50,50)
-- or a=touchArray("aaaaaaaa aaaa & b \\\\ c& d & t\\\\ a& 5&", 300,300)
-- the single variation allows one to choose a unique cell
--the table self.selected is a the set of selected cells, that is the
-- value of self.selected[1..","..2] is true if the cell 1,2 is touched and false otherwise
-- you can check if the cell i,j is selected via self:check(i,j) and
-- you can get the text in the cel i,j by self.array[i][j].text
touchArray = class()
function touchArray:init(string, x,y,type, cellsizex, cellsizey)
self:arrange(string)
if cellsizex~=nil then self.celsizex=cellsizex textWrapWidth(cellsizex)
end
if cellsizey~=nil then self.celsizey=math.max(cellsizey,20*self.size/self.celsizex)
else self.celsizey=math.max(self.celsizey,20*self.size/self.celsizex)
end
self.selected={}
self.x = x
self.y= y
self.type=type
self.array={}
for i,v in pairs(self.tab) do
self.array[i]={}
for j,k in pairs(v) do
table.insert(self.array[i],cell(k,x+self.celsizex*(j-1),y-
self.celsizey*i,x+self.celsizex*j,y-self.celsizey*(i-1)))
self.selected[i..","..j]=false
end
end
end
function touchArray:arrange(str)
self.tab={}
self.celsizex=0
self.celsizey=0
i=1
for a in string.gmatch(str,"([^\\\\]+)") do
self.tab[i]={}
for b in string.gmatch(a,"([^&]+)") do
d=b:match "^%s*(.-)%s*$"
w, h = textSize(d)
self.celsizex=math.max(self.celsizex, w)
self.celsizey=math.max(self.celsizey,h)
table.insert(self.tab[i], d)
end
i = i + 1
end
self.size=self.celsizex
end
function touchArray:draw()
textWrapWidth(self.celsizex)
for i , v in pairs(self.array) do
for j, k in pairs(v) do
k:draw()
end
end
end
function touchArray:check(i,j)
return self.selected[i..","..j]
end
function touchArray:touched(touch)
for i , v in pairs(self.array) do
for j, k in pairs(v) do
self.selected[i..","..j]=k.selected
k:touched(touch)
if self.type=="single" then
if k.selected then
for a,b in pairs(self.array) do
for c,d in pairs(b) do
if d ~= k then d.selected=false
end end end end end
end
end
-- Codea does not automatically call this method
end
cell=class(Control)
function cell:init(string,x,y,z,w)
Control.init(self,string,x,y,z,w)
self.selected=false
end
function cell:draw()
if self.selected then
self.background =color(175, 22, 47, 255)
else self.background=color(255, 255, 255, 255)
end
Control.draw(self)
end
function cell:touched(touch)
if self:ptIn(touch.x, touch.y) then
if touch.state == BEGAN then
self.selected = not self.selected
end
return true
end
return false
end
```