summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-08-30 19:38:31 +0200
committerGitHub <noreply@github.com>2022-08-30 19:38:31 +0200
commit62de7cec79584918397cc3fb72f2af15274c8748 (patch)
tree269c729ca40d8cf01d9cbfd431c582b980746720
parent6e6287f748782f829289fbde323264960e420157 (diff)
parent188d5593e1f080181a6e0302b7d54416d2cd96e8 (diff)
Merge pull request #59855 from KoBeWi/focus_thief
-rw-r--r--doc/classes/Callable.xml4
-rw-r--r--doc/classes/Control.xml1
2 files changed, 5 insertions, 0 deletions
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 @@
<return type="void" />
<description>
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]
</description>
</method>
<method name="get_method" qualifiers="const">
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 @@
<return type="void" />
<description>
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].
</description>
</method>
<method name="has_focus" qualifiers="const">