TWebElementActionItem and OnKeyPress

How do you find the key that was pressed in the TWebElementAction.OnExecute event? I want to preventDefault for when the EnterKey is pressed, but not other keys. The TWebEdit.OnKeyPress doesn't expose the event so I can't see how to do that there.

Thanks.

Getting close to the first release of this big TMS stack (Aurelius-XData-WebCore) project and just tidying up a few bits.

The original event object is passed via the parameter Event.JSEvent
For a key event, you should be able to cast this to a TJSKeyBoardEvent and read the details from there.

1 Like

Thanks Bruno.

Not needed in this case but it would be useful if the TJSKeyboardEvent could expose charCode and / or keyCode

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.

TJSKeyboardEvent is a wrapper around the JavaScript keyboard event object, so we can't expose something new. It just represents the object that JavaScript sends.