If I understand correctly I think Vaclav wants to go between tableviews like a slideview. Maybe this helps. I added a tableview listener and propagate the touches over to the touch rect.
[lua]
– touch listener
local function myTouchListener( event )
if ( event.phase == “began” ) then
--code executed when the button is touched
print( "object touched = "…tostring(event.target) ) --‘event.target’ is the touched object
elseif ( event.phase == “moved” ) then
--code executed when the touch is moved over the object
print( “touch location in content coordinates = “…event.x…”,”…event.y )
elseif ( event.phase == “ended” ) then
--code executed when the touch lifts off the object
print( "touch ended on object "…tostring(event.target) )
end
--return true --prevents touch propagation to underlying objects
end
– called when new row is added
local function onRowRender(event)
– Get reference to the row group
local group = event.row;
local h = event.row.contentHeight;
local w = event.row.contentWidth;
– fill row with red rectangle
local rect = display.newRect(group, w*0.5, h*0.5, w, h*0.9);
rect:setFillColor(1,0,0);
end
local group = display.newGroup();
– table view size
local rowHeight = 100; – content px
local rowCount = 10;
local tableViewHeight = display.contentHeight*0.5;
local tableViewWidth = display.contentWidth*0.5;
local tableViewTop = (display.contentHeight - tableViewHeight)*0.5;
local tableViewLeft = (display.contentWidth - tableViewWidth)*0.5;
– rectangle size
local rectHeight = display.contentHeight;
local rectWidth = display.contentWidth;
– add table view
local touchDetectingRectangle = display.newRect(group, display.contentCenterX, display.contentCenterY, rectWidth, rectHeight);
touchDetectingRectangle:setFillColor(0.5,0.5);
local function tableViewListener(event)
myTouchListener({phase = event.phase, target = touchDetectingRectangle, y = event.y, x = event.y})
end
local widget = require(“widget”)
local options =
{
top = tableViewTop, left= tableViewLeft,
hideBackground = true,
onRowRender = function(event) onRowRender(event) end,
width = tableViewWidth,–self.width-2*self.rowMargin,
height = tableViewHeight,
listener = tableViewListener,
isBounceEnabled = false;
--noLines = true,
}
local levelsTable = widget.newTableView( options);
group:insert(levelsTable);
local rowOptions =
{
rowHeight = rowHeight,
rowColor = { default={0,0}},
}
for i=1, rowCount do
levelsTable:insertRow(rowOptions)
end
– add event capturing rectangle over table view
touchDetectingRectangle:toFront(); – to make sure thad rectangke is abowe the table view
touchDetectingRectangle:addEventListener( “touch”, myTouchListener )
[/lua]