Hello Everyone,
First of all, this is my first post, so I’m not sure if I’m making the post on the right place…
I need some help here before I go crazy lol.
My tableView renders just fine, as it should. However, the event handler associated to onEvent is not even getting called.
Here is my code:
[lua]local list = Widget.newTableView
{
left = 0,
top = 10,
–width = 768,
height = 900,
maskFile = “mask.png”
}
–get some stuff from the database (this works fine)
local checkSheets = dbHandler.getCheckSheetTemplates();
– onEvent listener for the tableView
local function onRowTouch( event )
–this line is to test whether the event is getting triggered, but it isn’t
print(“Getting here”);
local row = event.target
local rowGroup = event.view
if event.phase == “press” then
rowGroup.alpha = 0.5;
elseif event.phase == “release” then
print(checkSheets[event.index].LuaFile);
Storyboard.gotoScene(checkSheets[event.index].LuaFile);
end
return true
end
– onRender listener for the tableView
local function onRowRender( event )
local row = event.target
local rowGroup = event.view
local text = display.newRetinaText(checkSheets[event.index].Name, 12, 0, native.SystemFont, 28)
text:setReferencePoint( display.CenterLeftReferencePoint )
text.y = row.height * 0.5
text:setTextColor( 0 )
local bg = display.newRect(0,0, rowGroup.width, rowGroup.height);
bg:setFillColor(230, 230, 230);
– must insert everything into event.view:
rowGroup:insert(bg);
rowGroup:insert( text )
end
for i = 1, #checkSheets do
local rowHeight, rowColor, lineColor;
list:insertRow
{
onEvent=onRowTouch,
onRender=onRowRender,
height=rowHeight,
isCategory=false,
rowColor=rowColor,
lineColor=lineColor,
}
end[/lua]
richard9 already tried it stripping out the dbHandler stuff, and the touch worked for them:
richard9: “I just tried your code (obviously had to strip out all of the dbhandler/checksheets stuff) and I can press a button on rows just fine. Are you getting any error messages in the terminal?”
No richard, there are no errors whatsoever. I also tried it on a device and no luck…
[import]uid: 48579 topic_id: 19020 reply_id: 319020[/import]
[import]uid: 48579 topic_id: 19020 reply_id: 73368[/import]