# HasFocus()

> Returns true if the TreeView and its EditorWindow have keyboard focus.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.5/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public bool HasFocus()
```

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

Additional Resources: [GUIUtility.keyboardControl](/engine/6000.5/script-reference/unityengine/guiutility/keyboardcontrol.md), [EditorWindow.focusedWindow](/engine/6000.5/script-reference/unityeditor/editorwindow/focusedwindow.md).
