Topic was automatically imported from the old Question2Answer platform.
Asked By
IHate
I’m creating linedits every time I press a button and I want to make it so just as it’s created it gets focused and ready to type in without any more inputs. I’ve tried grab_focus and grab_click_focus but it doesn’t seem to work. How can I achieve this result?
grab_focus() and deferred grab_focus does not always work in my experience. I have tried numerous ways to grab_focus on a LineEdit node in godot 3.5 and am not able to get it to work at all. It is not clear why grab_focus() is not working on LineEdit nodes.
As I said on my post I already tried those, but it ended up not been fault of the grab_focus but some problem with the theme I was using. Using the same settings but using the costume style instead of the theme works just fine, idk if it’s a bug or what.
IHate | 2019-07-25 08:31
Hi! Sorry for commenting on such an old post, but I have the same issue and I don’t know where else to ask. If you still remember, could you please elaborate on what causes the issue? I don’t really understand what you meant by “using the costume style instead of the theme”.
I know it’s a little late but for future reference and people willing to achieve the same result, you have to wait the next frame before calling grab_focus. So basically this will do it;