UPDATE 2:
I added a print statement to onRowTouch that prints event.target.index if phase == “press”. The print statement indicates that the row index is 12, yet the error message indicates that a nil value was passed. Anyway, here is the simulator output screen (ORT is print statement within onRowTouch and TVL is print statement in tableViewListener):
[lua]10:47:43.233 ORT: press
10:47:43.233 ORT: press
10:47:43.233 Pressed row: 12
10:47:43.233 ID: 416072
10:47:43.263 TVL Phase: began
10:47:43.263 TVL Content Pos: -1590.9401855469
10:47:43.263 TVL Phase: began
10:47:43.263 TVL Content Pos: -1590.9401855469
10:47:43.273 ERROR: Runtime error
10:47:43.273 ?:0: attempt to index field ‘_view’ (a nil value)
10:47:43.273 stack traceback:
10:47:43.273 ?: in function ‘touch’
10:47:43.273 ?: in function
10:47:43.273 ?: in function [/lua]
Here is onRowTouch:
[lua]local onRowTouch = function(event)
local phase = event.phase
print ("ORT: " … phase)
if (phase == “press”) then
print ("ORT: " … phase)
print("Pressed row: ", event.target.index)
print("ID: ", event.target.id)
end
if (phase == “tap”) then
print ("ORT: " … phase)
print("Tapped row: ", event.target.index)
print("ID: ", event.target.id)
end
if (phase == “release”) then
print("Released row: ", event.target.index)
print("ID: ", event.target.id)
if(event.target.index % 2 == 0) then
– hide the calendar selection button
_G.GUI.GetHandle(“MY_BUTTON”):show(false)
– get the current screen ratio
Globals.TVRatio = display.contentHeight / display.contentWidth
– 3 steps: destory the tableView
Globals.tableView:deleteAllRows()
display.remove( Globals.tableView )
–Globals.tableView:removeSelf()
Globals.tableView = nil
– unhide back button
Globals.btnBack.alpha = 1
– hide app name
Globals.appName.alpha = 0
– create the away/home buttons
Z.createAwayHome( event )
else
print(“Nothing to do here, this tap must be on a header.”)
end
end – end if phase == “release”
return true
end – end local function
Z.onRowTouch = onRowTouch[/lua]
Link to a screen capture of the above error message:
https://youtu.be/hVw6fZrkJ8k
Thank you!
Ed
P.S. is there a way to post code to main indenting?