cursor location

Hello,
I would like to select the position of the cursor when opening my page, to facilitate entering information in cells.
thank you in advance for your help.
Dominique

On your window, right-click and choose scripting. Place a script in the visionWindowOpened event handler.

def focus():
    system.gui.getParentWindow(event).getComponentForPath('Root Container.Text Field').requestFocusInWindow()
system.util.invokeLater(focus)

i try but there is a problem
Error running function from fpmi.system.invokeLater
Traceback (most recent call last):
File “event:visionWindowOpened”, line 2, in focus
AttributeError: ‘NoneType’ object has no attribute ‘requestFocusInWindow’

Make sure your path to the component is correct. If your component is not named 'Text Field' or if it is in a group, the path will be different and need to be modified. Next thing to check is whether your component you want to be in focus is in the main, or parent window, or if it is in a popup window. If the latter, the script will need to be altered.

the path seems correct to me.
what I don’t understand is
“AttributeError: ‘NoneType’ object has no attribute ‘requestFocusInWindow’”

It seems that is not finding the component, which is why it is of type None

THANK YOU
you were right it was a problem of the way.
cordially

1 Like