Designer Color Chooser vs Runtime Color Chooser

In the designer in Ignition v7.9.x Vision we have this Color Chooser, when we want to change the color on the component:
designer_choose_colot
In runtime, with the scripting function system.gui.chooseColor we get this:
runtime_choose_color
This is very hard to use because of the small color rectangles, especially on the big screens and bigger resolutions… and also on the tablets…

How can we get designer Color Chooser in the runtime?

1 Like

com.inductiveautomation.ignition.client.util.gui.color.ColorEditor is the class - you can import that and create an instance of it, but actually using it will be tricky. If you use a power table, you can use some static methods in that class - com.inductiveautomation.ignition.client.util.gui.color.ColorEditor#createTableCellEditor / createTableCellRenderer; using them natively in a popup frame like system.gui.chooseColor does would be more involved.

1 Like

I just want/need to give the user the possibility to choose his own colors for LowLow, Low, High and HighHigh alarms…


How can I use the com.inductiveautomation.ignition.client.util.gui.color.ColorEditor for that?
I need to color these five squares to what color the user chooses…

I’d “fake” your UI with a power table. Self contained window example here:
test_2020-02-21_1025.zip (5.5 KB)

initialize()

	from com.inductiveautomation.ignition.client.util.gui.color import ColorEditor
	self.putClientProperty("editor", ColorEditor.createTableCellEditor())
	self.putClientProperty("renderer", ColorEditor.createTableCellRenderer())

configureCell()

return {'renderer': self.getClientProperty('renderer').getTableCellRendererComponent(self.table, value, selected, False, rowIndex, colIndex)}

configureEditor()

return {'editor': self.getClientProperty('editor')}

1 Like

Looks cool, but I have Ignition v7.9.13…
Please…

The same code should work - you’ll have to implement isCellEditable and onCellEdited as well, but the default scripts should work. You’ll also want to make your dataset with the appropriate cells, making sure they’re actually Color type cells.

How can I choose Color type? There isn’t any to choose from…?

You’ll need to create the dataset with scripting.

table.data = system.dataset.toDataSet(["color"], [[system.gui.color(255, 0, 0)]])|

OK, I managed to create a power table with a color type cell in v7.9.13.
But there is no “drop down” for colors… click on the cell does nothing…
When I open the window in the designer I get this error in the output console:

Fwiw, letting the operator change alarm colours doesn’t sound like the best idea. These are better off being standardised so that all operators know exactly what they mean and they apply for any person, for any page. Just my 2c

3 Likes

Close the window and reopen it. The initialize function only runs when the power table is first created, and doesn’t re-run when the function is changed, so the renderer client property hasn’t been set up.

Thank you. Your code works flawlessly…
My problem was that I didn’t check the editable checkbox in the Table Customizer. I totally forgot about it.
Now everything is working and it’s already in production and users are happy.

2 Likes