Hi,
For my current project, I added a tableView object into a scrollView object. When I touch the tableView object, the event “pressed” is fired. However, the tableView object never fires any touch events after that, resulting in the tableView getting stuck/frozen.
Even after trying to set the focus on the tableView in the event.phase == “pressed” function, or after returning true, the tableView never fires another phase event.
What I believe is happening is that the scrollView steals the focus after touching the tableView object, yet returning true won’t keep it from doing so.
Here is stripped down version of my code to show you what I mean and what’s happens. Is this a bug and if so, would it be easy to fix? Or would there be a workaround in the mean time?
Thanks!
[code]local widget = require “widget”
local scrollView = widget.newScrollView( { width = 1024, height = 600, maskFile = “scroll_mask.png” } )
local tableView = widget.newTableView( { top=50, width=100, height=100, maskFile = “table_mask.png” } )
for i=1,20 do – loop to create 20 rows
local onRowTouch = function( e )
if e.phase == “press” then
– this event is fired
display.getCurrentStage():setFocus( tableView ) – doesn’t seem to do much
print( “pressed” )
return true
elseif e.phase == “release” then
– this event is never fired
print( “released” )
end
end
local onRowRender = function( e ) – render the row
local row = e.target
local rowGroup = e.view
local text = display.newRetinaText( “bla”, 12, 0, native.systemFont, 14 )
text:setReferencePoint( display.CenterLeftReferencePoint )
text.y = row.height * 0.5
rowGroup:insert( text )
end
tableView:insertRow { – create a row
onEvent=onRowTouch,
onRender=onRowRender,
height=30,
isCategory=false
}
end
scrollView:insert( tableView )[/code] [import]uid: 86582 topic_id: 28374 reply_id: 328374[/import]