diff options
author | kobewi <kobewi4e@gmail.com> | 2022-04-04 01:24:01 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-08-30 14:20:43 +0200 |
commit | 188d5593e1f080181a6e0302b7d54416d2cd96e8 (patch) | |
tree | b24f2753e5374977602c59ec78f41854a8bfcd7f | |
parent | 0bf3f7915780f30fab4db323e843b35bf9210548 (diff) |
Mention that grab_focus is more reliable deferred
-rw-r--r-- | doc/classes/Callable.xml | 4 | ||||
-rw-r--r-- | doc/classes/Control.xml | 1 |
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"> |