---
name: "closeDisplay"
type: command
status: ok
groups: ["GUI Control"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/closeDisplay
revid: 323157
updated: 2022-07-01T10:11:40Z
---

# closeDisplay

*Command · GUI Control · Arma 3 v0.50 · introduced in Armed Assault v1.00*

## Description

Closes given display with exit code. It does not instantly close the display but does it on next simulation cycle. Most common exit codes are:

```cpp
#define IDC_OK        1 // emulate "OK" button
#define IDC_CANCEL    2 // emulate "Cancel" button
```

> [!IMPORTANT]
> Sometimes when one display is opened on top of another display the previous display may not close properly; some display EHs such as "onUnload" may never fire.
> Use this command to manually handle such displays.

## Syntax

```sqf
display closeDisplay exitCode
```

**Parameters:**

- `display`: [Display](../topics/Display.md)
- `exitCode`: [Number](../topics/Number.md)

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
_display closeDisplay 1;
```

### Example 2

```sqf
#define IDC_OK 1
_display closeDisplay IDC_OK;
```

## See also

[createDisplay](../commands/createDisplay.md) · [closeDialog](../commands/closeDialog.md)

<sub>Source: [BI Community Wiki — closeDisplay](https://community.bistudio.com/wiki/closeDisplay) (revision 323157).</sub>
