Perspective Request Focus in Window

Hello,

I tried to transfer one of my Vision projects to Perspective.
I have android based scanner and 2 text fields where I want operators to scan Work Order Number and Part Number. In Vision, I just added script RequestFocusInWindow() and it works perfect, however the same script is not working in Perspective module.
Am I missing something there or it is impossible.

Best regards
Pawel

The main thing to keep in mind when converting vision to perspective, is all of the scripts are executed at the gateway scope. so depending on what this script is trying to do, the functions may not work or may need additional parameters.

I also haven’t messed with component focus yet in perspective, so there may be some quirks there too.

As @grietveld said previously, all Perspective scripts execute on the Gateway, so be aware that any scripting you’re doing in Perspective will execute in the Gateway scope - even if the method has multiple scopes available to it.

With that being said, Perspective uses Views/Pages, not Windows (these are a Vision concept), so the requestFocusInWindow() method is of no use to you here.

What you could do is directly address the component you’d like to put focus onto and apply focus to it:

From another component:

self.getSibling('TextField').focus()

From the root container:

self.view.rootContainer.getChild('TextField').focus()
3 Likes

Thanks a million. This is working.

1 Like