How to tell if any textField has keyboard focus in editor?

Hi,

I want to do shortcut keys in my editor, and I don’t want it be triggered when we do typing in some TextField.

Although there’s EditorGUIUtility.editingTextField, but this flag stays true even when you clicked outside the TextField, so this gives a unsatisfying result.

Thanks in advance,

Ok this may be a bit old, but here the reason, EditorGUIUtility.editingTextField stays TRUE could be, that just clicking outside of a textfield doesn’t necessarily make the focus of the textfield go away, it can stay focused.
RETURN will remove the focus from the textbox.
ESC will remove the focus from the textbox with undoing the edit.
TAB will sometimes also remove the focus, depending on whats the next focusable ui element.

On the other hand, if you have the issue of EditorGUIUtility.editingTextField staying FALSE, even when the textbox is focused, try using EditorGUILayout.TextField instead of GUILayout.TextField, that solved my issue.

How are you checking the Debug.Log() and are you doing this in the Editor itself (i.e. EditorWindow)? – If you are doing this in, say, an OnGUI event or in a custom Update method via delegate, then many times, the Debug.Log() does not change without mouse movement, and even as such, this depends on where you check and what else is taking up mouse input and then calling Use() on it. This could explain why the Debug.Log() is not updating.

That being said, the function EditorGUIUtility.editingTextField should only be called in the OnGUI event anyhow, and if all that is done correctly, it does handle input fields such as the searchbox in the project window (and other edit fields) correctly.