# Tracking the ActiveWindow

In certain scenarios you may need to track the moment the **ActiveWindow** of **RadDock** is being changed. For this purpose **RadDock** exposes two events:

* **ActiveWindowChanging:** This event is fired when the active window is about to be changed, but it is still not changed. This allows you to cancel the active window changing operation. Depending on the scenario, you may need to understand which the currently active window is and which is the window that is about to become active. For this purpose, the event arguments of `ActiveWindowChanging` expose two useful properties:

  * **NewWindow**: returns the dock window that is about to become active.

  * **OldWindow**: returns the currently active window.

  In the picture below the currently active window is `toolWindow2`. Activating `toolWindow1` will cause `ActiveWindowChanging` to fire, and we can expect **NewWindow** to return `toolWindow1` and **OldWindow** to return `toolWindow2`.

  ![WinForms RadDock Active Window](https://www.telerik.com/products/winforms/documentation/assets/30eca6f6003c78d45539dcbccd9bd414/dock-object-model-tracking-the-activewindow001.png)

* **AcitveWindowChanged:** is fired after the active window is changed. Its arguments provide one property:

  * **DockWindow**: returns the activated window.

Considering the same scenario, where the currently active window is `toolWindow2`, activating the `toolWindow1` will first fire **ActiveWindowChanging** and if it is not canceled, **ActiveWindowChanged** will be fired. There, the **DockWindow** property from the event arguments will return `toolWindow1`. In this case, you may also use **RadDock.ActiveWindow** that will also return `toolWindow1`.

## See Also

* [AllowedDockStates](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/alloweddockstates)
* [Creating a RadDock at Runtime](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/creating-a-raddock-at-runtime)
* [ Creating ToolWindow and DocumentWindow at Runtime](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/creating-toolwindow-and-documentwindow-at-runtime)
* [Customizing Floating Windows](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/customizing-floating-windows)
* [Customizing TabStrip Items](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/customizing-tabstrip-items)
* [Building an Advanced Layout at Runtime](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/example-building-an-advanced-layout-at-runtime)
* [RadDock Properties and Methods](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/raddock-properties-and-methods)
* [Removing ToolWindow and DocumentWindow at Runtime](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/removing-toolwindow-and-documentwindow-at-runtime)
* [Tabs and Captions](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/tabs-and-captions)
* [ToolWindow and DocumentWindow Properties and Methods](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/toolwindow-and-documentwindow-properties-and-methods)
* [Accessing DockWindows](https://www.telerik.com/products/winforms/documentation/controls/dock/object-model/accessing-dockwindows)
