Show a warning if you try to grab focus when not allowed, closes #15388
This commit is contained in:
parent
47a4d78dbf
commit
f6fbf841d5
1 changed files with 4 additions and 1 deletions
|
@ -2062,8 +2062,11 @@ void Control::grab_focus() {
|
|||
if (!is_inside_tree()) {
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
}
|
||||
if (data.focus_mode == FOCUS_NONE)
|
||||
|
||||
if (data.focus_mode == FOCUS_NONE) {
|
||||
WARN_PRINT("This control can't grab focus. Use set_focus_mode() to allow a control to get focus.");
|
||||
return;
|
||||
}
|
||||
|
||||
get_viewport()->_gui_control_grab_focus(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue