Power Table Stray Typing

I could be completely missing something simple with the Power Tables. But is there any way to prevent stray typing from being accepted in a Power Table cell? I would like to make it so the user is forced to double click or press Enter on a cell to be able to actually edit it. However, even with the Edit Click Count property set to 2, it will allow stray typing in a cell that doesn’t have focus but is selected/highlighted This can be problematic for us with operators accidentally bumping keys with a cell highlighted.

I’ve tried setting up some custom properties with onDoubleClick and the isCellEditable extension functions, but anything I add ends up requiring a triple click because of the order with which those extension functions trigger.

Hopefully this all makes sense. Any help would be appreciated.

Thanks in advance!

Ignition 7.9.6
Client is MacOSX 10.12.6
Gateway is Windows 7

Hmm, looks like the ‘edit click count’ field isn’t doing what it’s supposed to. Try this, in configureEditor:

	from javax.swing import DefaultCellEditor, JTextField
	from java.lang import String
	from java.awt.event import MouseEvent
	class CustomCellEditor(DefaultCellEditor):
		def isCellEditable(self, event):
			if isinstance(event, MouseEvent):
				return DefaultCellEditor.isCellEditable(self, event) and event.getClickCount() >= 2

	if self.data.getColumnType(colIndex) == String:
		return {'editor': CustomCellEditor(JTextField())}
1 Like

That did the trick! Thank you!

Glad to know I wasn’t imagining things. I thought it used to prevent the stray typing when the edit click count was set to two.

Thanks again,

Along the same lines, any thoughts on the best way to set the focus of a cell when pressing Enter? I have the following code in the “initialize” extension function on my power table to change the behavior of the Enter button press. But I can’t figure out how to actually set the current selected cell to focus owner.


from java.awt.event import KeyEvent
from javax.swing import KeyStroke, JTable, AbstractAction

class EnterPressEvent(AbstractAction):
	def __init__(self, t):
		self.t = t
	def actionPerformed(self, event_trigger):
		print "How do I set focus here?"

self.getTable().getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter_Press_Event_Triggered")
self.getTable().getActionMap().put("Enter_Press_Event_Triggered", EnterPressEvent(self))