From 188d5593e1f080181a6e0302b7d54416d2cd96e8 Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 4 Apr 2022 01:24:01 +0200 Subject: Mention that grab_focus is more reliable deferred --- doc/classes/Callable.xml | 4 ++++ doc/classes/Control.xml | 1 + 2 files changed, 5 insertions(+) diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 6838bdeb70..1fcaf6d866 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -75,6 +75,10 @@ Calls the method represented by this [Callable] in deferred mode, i.e. during the idle frame. Arguments can be passed and should match the method's signature. + [codeblock] + func _ready(): + grab_focus.call_deferred() + [/codeblock] diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 0e71dbd0b1..71798d2574 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -553,6 +553,7 @@ Steal the focus from another control and become the focused control (see [member focus_mode]). + [b]Note[/b]: Using this method together with [method Callable.call_deferred] makes it more reliable, especially when called inside [method Node._ready]. -- cgit v1.2.3