summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-09-06 13:32:34 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-09-06 13:32:34 -0300
commitf6fbf841d50d85f49fa127afdb29ebf23fe5974d (patch)
treef58638f9492df1960caa6ea53e44d74d38bd3246
parent47a4d78dbfd735c55ec263688c2ec30af9a4654a (diff)
Show a warning if you try to grab focus when not allowed, closes #15388
-rw-r--r--scene/gui/control.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index fad91c29cf..dc042b88d2 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -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);
}