Change Row Color of Power Table Based On Mouse Hover

Hi all,

I am attempting to change the color of a row in a power table if the mouse is hovering over the row. Is there an easy way to do this that I’m missing? If not, has anyone done this before that has any suggestions for how to go about it?

Figured it out:

Timer script runs every 100 ms to get the row the mouse is hovering over:

if event.propertyName == ‘value’:
from java.awt import MouseInfo, Point
table = event.source.parent.getComponent(‘Power Table’).getTable()
p = MouseInfo.getPointerInfo().getLocation()
mousex = p.x - table.getLocationOnScreen().x
mousey = p.y - table.getLocationOnScreen().y
mousep = Point(mousex,mousey)
cellCol = table.columnAtPoint(mousep)
cellRow = table.rowAtPoint(mousep)
event.source.parent.getComponent(‘Power Table’).hoverRow = cellRow

Which updates a property on my table called hoverRow

configureCell on my table paints the row with the highlight color:

if self.hoverRow == rowIndex:
return {‘background’:system.gui.color(242,242,242)}
And propertyChange event on hoverRow repaints the table:

if event.propertyName == ‘hoverRow’:

Hope someone finds this useful!