Animated (blinking) row background in Power Table

Hello, I'm trying to create a blinking background for rows in Vision Power Table. Can anyone help me on how something like that would be implemented?

You will need to create a tag that is connected to a timer component for your blinking rate. This could be on the gateway, client, or in the PLC. Then use scripting to color each row in your table and use the blink tag to determine which color it should be (i.e. "alarm" for row is true, if(blink, red, white) ).

I don't believe that this could be done reliably with the configureCell extension function alone since it doesn't fire unless triggered by some event that would require the cells to be painted, but from my experience working with tables, I can imagine quite a few approaches that would probably work.

Just taking a quick look at the problem, I was able to get the effect you are looking for with the following procedure:
• Add a custom Boolean propery to the power table called 'blink'
• Add a timer component to the window
• Add the following script to the timer component's action performed event handler:

powerTable = event.source.parent.getComponent('Power Table') #Change this path to match your project
if powerTable.blink:
	powerTable.blink = False
else:
	powerTable.blink = True
powerTable.table.getModel().fireTableDataChanged() #This line can be anything that will trigger a repaint

• Finally, script the configureCell extension function as needed. In my test project, I used the following:

#def configureCell([...]):
	if selected:
		return {'background': self.selectionBackground}
	elif self.blink:
		return {'background': 'white'}
	else:
		return {'background': '#DDDDDD'}

Here is the result:

3 Likes

Thanks, both of you!

1 Like