Dynamic Unselected Backgroud Color for Alarm tab

Hello,

I want to assign the the Unselected Background Color of my Alarms tab to a custom property I called StatusColor. This custom property type is Color. StatusColor will change from grey to red in the presence of an alarm. I want StatusColor to define the Unselected Background Color for the Alarm tab. Therefore, I created a scrip under property change in order to assign its color to the Unselected Backgrond Color of the Alarm tab.
However, even though I don’t get a warning or error, my script does not seem to do anything:

from java.awt import Color
color = event.source.StatusColor
tabDataset=event.source.parent.getComponent(‘Tab Strip’).tabData
system.dataset.setValue(tabDataset, 5,17, color)

Could someone help me find out what I’m missing?

Thanks in advance.

Jose

The system.dataset.setValue() function doesn’t modify the dataset in place – that’s not allowed. Instead, it returns a new dataset with the modification. You must assign that back to the component property.

pturmel,

Thank you for the clarification. You wouldn’t happen to know the proper way to assign the new dataset back?

Jose

Like so:

color = event.source.StatusColor
tabStrip = event.source.parent.getComponent('Tab Strip')
tabStrip.tabData = system.dataset.setValue(tabStrip.tabData, 5, 17, color)
2 Likes

That Worked perfectly. Thank you for your help!