Perspective: Object onKeyPress Event

Hello Everybody,

I use 8.1.0 v of Ignition
I have one problem.
Is it okay that Tree Element onKeyPress Event does not work?
I am talking about this:


I just print text to Output Console when any key was pressed…

system.perspective.print('Pressed')

and this script does not work for me…

For any Perspective component, the onKeyPress Event requires that the component have focus (otherwise any component with a similar event would also fire). I don’t believe that the tree ever actually gets focus though, because it isn’t an input. So I wouldn’t expect that event to do anything when used as part o the Tree component.

Thanx for Your Replay.

It’s sad, because I need this action( :worried:

There is development underway for a key-listener for Sessions. It could possibly work for you, depending on what you’re trying to do. It captures key strokes within the session and allows for firing actions based off of the keystrokes. You would need some logic like this within the script action for the upcoming Event/Listener:

modification_keys = ['w', 'a', 's', 'd']
if event.page.props.path == 'some/arbitrary/path' and event.key in modification_keys:
    # do something to the tree with event.key
1 Like

Thanx for Your Replay!

I just wanted to select the object from menu, press ENTER and it opens Vision Window for object. That’s all.
But… I found another solution for this: I just use for it :point_right: onContextMenu :point_left: Event.

But… now I know this Information You posted and I’ll try it next time for sure! :pray: