# KeyEvent()

> Override this method to handle events when the TreeView has keyboard focus.

## Definition

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

```csharp
protected virtual void KeyEvent()
```

### Remarks

The TreeView should not handle key events if it does not have keyboard focus therefore this method is only called when [GUIUtility.keyboardControl](/engine/6000.5/script-reference/unityengine/guiutility/keyboardcontrol.md) == [TreeView\<TIdentifier>.treeViewControlID](/engine/6000.5/script-reference/unityeditor/imgui/controls/treeview1/treeviewcontrolid.md).
