setting the background color for a row that's already been inserted into TableView widget?

I used row:setRowColor() and it works perfectly for most situations. But for some reason it doesn’t work when I try using in event phases “tap” and “release”. So I’m trying alternatives.

I saw someone use event.background:setFillColor(), but it was an old post and I’m getting event.background = nil… so I guess it’s no longer viable.

Any other way I can achieve row changing colour?

I just tried row._rowColor = {default = color, over = color}, but just like with row:setRowColor() it failed when I tried using it for  tableView widget’s “tap” and “release” phase for touchEvent…

 

I guess my real problem is: why doesn’t the coloring function work in those 2 phases?! For “press” it works perfectly

Normally in onRowRender I will create my own background display.newRect. When the row renders, you draw whatever background color your code thinks it needs. You can add the background as a child to the row object, i.e. row.background and then you can easily access it from onRowTouch

Rob

It worked really well, thanks Rob! Some minor issues with it blocking some objects unexpectedly and toFront() on the blocked object not fixing it… but that’s a different story.

I used this and it worked like a charm!

local rowColor = {default={0,0,0,0}, over={1,0.5,0,0.2}} tableView:insertRow{ rowColor = rowColor, params = { ... } }

I just tried row._rowColor = {default = color, over = color}, but just like with row:setRowColor() it failed when I tried using it for  tableView widget’s “tap” and “release” phase for touchEvent…

 

I guess my real problem is: why doesn’t the coloring function work in those 2 phases?! For “press” it works perfectly

Normally in onRowRender I will create my own background display.newRect. When the row renders, you draw whatever background color your code thinks it needs. You can add the background as a child to the row object, i.e. row.background and then you can easily access it from onRowTouch

Rob

It worked really well, thanks Rob! Some minor issues with it blocking some objects unexpectedly and toFront() on the blocked object not fixing it… but that’s a different story.

I used this and it worked like a charm!

local rowColor = {default={0,0,0,0}, over={1,0.5,0,0.2}} tableView:insertRow{ rowColor = rowColor, params = { ... } }