---
name: "inGameUISetEventHandler"
type: command
status: ok
groups: ["GUI Control - Event Handlers", "Event Handlers", "Interaction"]
arma3_since: "0.50"
locality: {"argument": null, "effect": "local", "server_exec": false}
source: https://community.bistudio.com/wiki/inGameUISetEventHandler
revid: 378923
updated: 2026-08-14T20:25:31Z
---

# inGameUISetEventHandler

*Command · GUI Control - Event Handlers, Event Handlers, Interaction · Arma 3 v0.50 · introduced in Armed Assault v1.00*

Locality: effect **local**

## Description

Sets given event handler of in-game UI. If EH function returns [true](../commands/true.md), performed action is overridden. Event handlers available are:
- "PrevAction" - mouse scroll up
- "Action" - action key press
- "NextAction" - mouse scroll down
In order to remove a previously added event handler, set it again with an empty *code* string `""`.

> [!NOTE]
> **Since Arma 3 v2.22 consider using [hideActions](../commands/hideActions.md)**

> [!IMPORTANT]
> This is a "set" command, which means event handlers are not stackable and will replace previously set event handlers of the same type.

> [!NOTE]
> **Arma 3:** Since Arma 3 v1.50 the event handler receives an array of the selected/activated action's arguments in `_this` variable:
>
> ```sqf
> params ["_target", "_caller", "_index", "_engineName", "_text", "_priority", "_showWindow", "_hideOnUse", "_shortcut", "_visibleMenu", "_eventName"];
> ```
>
> - _target: [Object](../topics/Object.md) - target object to which action is attached
> - _caller: [Object](../topics/Object.md) - caller object, basically [player](../commands/player.md)
> - _index: [Number](../topics/Number.md) - index of the action in action menu (0 - top most)
> - _engineName: [String](../topics/String.md) - engine based action name ("User" for user added actions)
> - _text: [String](../topics/String.md) - [localize](../commands/localize.md)d action plain text as seen by the caller
> - _priority: [Number](../topics/Number.md) - action *priority* value
> - _showWindow: [Boolean](../topics/Boolean.md) - action *showWindow* value
> - _hideOnUse: [Boolean](../topics/Boolean.md) - action *hideOnUse* value
> - _shortcut: [String](../topics/String.md) - action *shortcut* name or ""
> - _visibleMenu: [Boolean](../topics/Boolean.md) - [action menu visibility](../commands/isActionMenuVisible.md) - on first scroll or action press the menu is still invisible, the menu is shown but no action is performed
> - _eventName: [String](../topics/String.md) - event name

## Syntax

```sqf
inGameUISetEventHandler [handlerName, code]
```

**Parameters:**

- `handlerName`: [String](../topics/String.md)
- `code`: [String](../topics/String.md)

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

## Examples

### Example 1

```sqf
inGameUISetEventHandler ["Action", "hint 'Lights, Camera, Action!'; true"];
sleep 10;
inGameUISetEventHandler ["Action", ""]; // removes the "Action" EH
```

### Example 2

```sqf
inGameUISetEventHandler ["PrevAction", "hint str _this; false"];
inGameUISetEventHandler ["NextAction", "hint str _this; false"];
inGameUISetEventHandler ["Action", "hint str _this; false"];
```

### Example 3

Deny any weapon disassembly:

```sqf
inGameUISetEventHandler ["Action", "
    if (_this select 3 == 'DisAssemble') then {
        hint 'You are not allowed to do this';
        true
    }
"];
```

### Example 4

Detect explosive/mine placement:

```sqf
private _onMagazineUse = '
    params ["_target", "", "", "_action", "", "", "", "", "", "", "_event"];
    if (_action == "UseMagazine") then {
        if (_event == "Action") then {
            _target spawn {
                waitUntil {!(all_magazines isEqualTo magazines _this)};
                {
                    0 = all_magazines deleteAt (all_magazines find _x);
                } count magazines _this;
                hint format ["Magazine Used: %1", all_magazines select 0];
            };
        } else {
            all_magazines = magazines _target;
        };
    };
    false
';
inGameUISetEventHandler ["PrevAction", _onMagazineUse];
inGameUISetEventHandler ["NextAction", _onMagazineUse];
inGameUISetEventHandler ["Action", _onMagazineUse];
```

## See also

[isActionMenuVisible](../commands/isActionMenuVisible.md) · [addEventHandler](../commands/addEventHandler.md) · [ctrlAddEventHandler](../commands/ctrlAddEventHandler.md) · [displayAddEventHandler](../commands/displayAddEventHandler.md) · [actionIDs](../commands/actionIDs.md) · [actionParams](../commands/actionParams.md) · [addAction](../commands/addAction.md) · [setUserActionText](../commands/setUserActionText.md) · [showHUD](../commands/showHUD.md) · [inputAction](../commands/inputAction.md) · [removeAction](../commands/removeAction.md) · [removeAllActions](../commands/removeAllActions.md) · [action](../commands/action.md) · [enableWeaponDisassembly](../commands/enableWeaponDisassembly.md)

## Community notes

**AgentRev** — 2016-05-12

In case of the "Action" event, (*_showWindow* || *_visibleMenu*) also denotes if the action is performed or not. For example, if the action menu is closed or fading off, pressing Spacebar will bring it up and trigger an "Action" event; in that case, *_visibleMenu* is false. But if the action menu is open, and Spacebar is pressed to perform the selected action, then *_visibleMenu* will be true. If *_showWindow* is true, then it means the action was performed, regardless of *_visibleMenu*.

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