Perspective Focus

Hello all,

I am trying to gain focus on a component in perspective. My component is sitting inside a nested flex container.

image

I tried to supply this code into the startup event of the component itself:

self.focus()

did not work, then tried to write the focus command on the root container and the view itself did not work either. Usually this should work but I do not know what I am doing wrong here.

I don’t know how well applying focus works if a component is moving around. You MIGHT be running into a situation where the component starts up (and therefore fires off its onStartup Event), but the component is then moved around as the flex container grows/shrinks/flexes due to other components. Just out of curiosity, does it work if you wait for 3 seconds before invoking self.focus()?

from time import sleep
sleep(3)
self.focus()
2 Likes

That fixed the issue. Thank you!