diff options
author | = <itsnl252@gmail.com> | 2022-09-05 20:30:44 +0200 |
---|---|---|
committer | = <itsnl252@gmail.com> | 2022-09-07 17:04:26 +0200 |
commit | 2de52c74aea60f2115499a9bcd3698d5e96c4af4 (patch) | |
tree | 5d7dd65553787ab4ca873ad250a804b514e9d04c | |
parent | 90801a415314f29eb5c590f85a7751443e54b83a (diff) |
Fix "grab_focus: Condition "!is_inside_tree()" is true" when AcceptDialog was visible from the editor.
-rw-r--r-- | scene/gui/dialogs.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 0a1aeeda71..1c2243067b 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -60,9 +60,16 @@ void AcceptDialog::_update_theme_item_cache() { void AcceptDialog::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_VISIBILITY_CHANGED: { + case NOTIFICATION_POST_ENTER_TREE: { if (is_visible()) { get_ok_button()->grab_focus(); + } + } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + if (is_visible()) { + if (get_ok_button()->is_inside_tree()) { + get_ok_button()->grab_focus(); + } _update_child_rects(); parent_visible = get_parent_visible_window(); if (parent_visible) { |