Power Chart onCellEdited is invoked twice

I have implemented an onCellEdited method in PowerChart to validate an entry. I observe that an invalid entry causes the warning dialog comes up twice, causing the user to dismiss two identical dialogs. so it seems onCellEdited is being invoked twice for a single edit…

Hi all, any update or response to this? I am seeing this behavior too.

I am having the exact same problem. Checking newValue != oldValue does not help. Must be getting called twice right up front.

I’m seeing the same issue. Searching got me here but no further.
I’m using Ignition Version 7.8.1

The onCellEdited is invoked twice only if I open a system.gui.confirm or system.gui.messageBox from the onCellEdited script. My intention was to use a confirm dialog box to show the user the old value and the new value and give the user a chance to cancel the update.

Please respond if there are any work arounds or updates for this.

Thank you,

John

Unfortunately, this is a problem caused by the way modal popups generated by the system.gui.* functions interrupt focus. You can use an invokeLater call to get around this issue:

	def message():
		return system.gui.confirm("message", "title", False)
	
	system.util.invokeLater(message)

EDIT: Also, attached is a workaround that keeps the ‘Confirm’ message box functional. I’ll leave putting correct values into the message box an exercise for the reader. Also, this relies on implicit type conversion (because handling the type would be a good deal more work) but this should work for most/all of the common data types (eg, strings, ints, floats, booleans will all work fine with this code).

3 Likes