---
id: "E:cAlgo.API.Window.Deactivated"
kind: "event"
type: "T:cAlgo.API.Window"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/Deactivated/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Window.Deactivated

Member of [Window](https://help.ctrader.com/ctrader-algo/references/Controls/Windows/Window/index.md).

## Deactivated

This event gets triggered when window is deactivated

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Never shown: Show, Hide and Close send nothing; IsVisible stays false and window events never fire.
- Cloud: Never shown: Show, Hide and Close send nothing; IsVisible stays false and window events never fire.

C#:

```csharp
public event Action<WindowDeactivatedEventArgs> Deactivated;
```

Python:

```python
window.Deactivated += handler  # handler(obj: WindowDeactivatedEventArgs)
```

### Returns

`Action<WindowDeactivatedEventArgs>` — 

### Examples

C#:

```csharp
var window = new Window { Title = "Order entry", Width = 300, Height = 200 };
window.Deactivated += args => Print("Window '{0}' deactivated", args.Window.Title);
window.Show();
```

Python:

```python
def on_start(self):
    window = Window()
    window.Title = "Order entry"
    window.Deactivated += self.on_window_deactivated
    window.Show()

def on_window_deactivated(self, args):
    api.Print(f"Window '{args.Window.Title}' deactivated")
```

