Error on tableView setFillColor method

I am using some code someone posted on here showing how to high lite the selected row item in a tableView. It works most of the time but sometimes when I am trying to scroll down I get the error below:

Runtime Error

widgetLibrary/widget_tableview.lua: 452: attempt to call method “setFillColor” (a nil value)

Here is the code I am using for the onRowTouch:

local function onRowTouch1( event ) local phase = event.phase local row = event.target if "press" == phase then for i = 1, list1:getNumRows() do if i == row.index then list1.\_view.\_rows[i].\_rowColor.default = { 1, 100/255, 100/255 } else list1.\_view.\_rows[i].\_rowColor.default = { 1, 1, 1 } end; end A1 = strings1[event.target.index] composer.setVariable( "Month", A1 ) list1:reloadData() end end

And the rowRender code

local function onRowRender1( event ) local phase = event.phase local row = event.row local groupContentHeight = row.contentHeight local Title = event.row.params.rowTitle local rowTitle = display.newText( row, Title, 0, 0, native.systemFont, 32) rowTitle.x = 20 rowTitle.anchorX = 0 rowTitle.anchorY = 0 rowTitle.y = 30 --rowTitle:setFillColor( 0, 0, 0 ) end

Hi Warren,

Can you be more specific about what’s going on when this error occurs? There are a bunch a various “interactive points” with TableViews so getting a clearer indication of what triggers this will help us diagnose.

Brent

All I am doing is scrolling the tableview. It happens in the simulator and on the device. When I go to scroll down at times it will high-lite one when I touch it and then give the error. Sometimes I can scroll without one being high-lited and no error.  I even commented out the setFillColor line and still got the error. It must happen when it is reloading the data. Any thoughts? Wish I could put an error trap onit to ignore if it happens.

That’s odd… you’re saying you have no (active) command to “:setFillColor()” in your app, but it’s still throwing that error, indicating it may be an internal thing? I assume you’re using a recent build of Corona and not a modified version of the open source widget library?

Brent

Hi Warren,

Can you be more specific about what’s going on when this error occurs? There are a bunch a various “interactive points” with TableViews so getting a clearer indication of what triggers this will help us diagnose.

Brent

All I am doing is scrolling the tableview. It happens in the simulator and on the device. When I go to scroll down at times it will high-lite one when I touch it and then give the error. Sometimes I can scroll without one being high-lited and no error.  I even commented out the setFillColor line and still got the error. It must happen when it is reloading the data. Any thoughts? Wish I could put an error trap onit to ignore if it happens.

That’s odd… you’re saying you have no (active) command to “:setFillColor()” in your app, but it’s still throwing that error, indicating it may be an internal thing? I assume you’re using a recent build of Corona and not a modified version of the open source widget library?

Brent