---
name: "ctrlMapSetPosition"
type: command
status: ok
groups: ["GUI Control - Map"]
arma3_since: "2.06"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/ctrlMapSetPosition
revid: 352027
updated: 2024-02-01T23:24:23Z
---

# ctrlMapSetPosition

*Command · GUI Control - Map · Arma 3 v2.06*

## Description

Sets position and size of the given map control and recalculates control center. The effect is immediate and no [ctrlCommit](../commands/ctrlCommit.md) is necessary, unlike with [ctrlSetPosition](../commands/ctrlSetPosition.md) command.

> [!NOTE]
> The Map control is different from other controls and normally does not behave well inside Controls Groups. When this command is used on the Map control inside a Controls Group, The *x* and *y* will be treated as relative position to the top left of Controls Group. Use this command to set position before you use [ctrlMapAnimAdd](../commands/ctrlMapAnimAdd.md). Use this command to update Map control after its position or size had been changed or the Map control was created dynamically (Example 2). If you move Controls Group, use this command to refresh Map control (Example 3).

## Syntax

```sqf
map ctrlMapSetPosition [x, y, w, h]
```

**Parameters:**

- `map`: [Control](../topics/Control.md) - Map control
- `x`: [Number](../topics/Number.md) - (Optional) Left top x of map control
- `y`: [Number](../topics/Number.md) - (Optional) Left top y of map control
- `w`: [Number](../topics/Number.md) - (Optional) Width of map control
- `h`: [Number](../topics/Number.md) - (Optional) Height of map control

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

## Examples

### Example 1

```sqf
_map ctrlMapSetPosition [0,0,1,1];
```

### Example 2

```sqf
_map ctrlSetPosition [0.5, 0.5, 0.5, 0.5];
_map ctrlCommit 0;
_map ctrlMapSetPosition []; // sync
```

### Example 3

```sqf
with localNamespace do
{
    private _display = findDisplay 46 createDisplay "RscDisplayEmpty";
    private _ctrlGroup = _display ctrlCreate ["RscControlsGroup", -1];
    private _ctrlText = _display ctrlCreate ["RscText", -1, _ctrlGroup];
    _ctrltext ctrlSetPosition [0, 0, 1, 1];
    _ctrlText ctrlSetBackgroundColor [1, 0, 0, 0.5];
    _ctrlText ctrlCommit 0;
    private _ctrlMap = _display ctrlCreate ["RscMapControl", -1, _ctrlGroup];
    _ctrlMap ctrlMapSetPosition [0, 0, 0.5, 0.5]; // effect is immediate
    _ctrlMap ctrlMapAnimAdd [0, ctrlMapScale _ctrlMap, player];
    ctrlMapAnimCommit _ctrlMap;
    _ctrlGroup ctrlSetPosition [safeZoneX, safeZoneY, 1, 1];
    _ctrlGroup ctrlCommit 0.3; // non instant transition
    _ctrlMap ctrlMapSetPosition []; // instant sync to new _ctrlGroup position
};
```

## See also

[ctrlMapPosition](../commands/ctrlMapPosition.md) · [ctrlSetPosition](../commands/ctrlSetPosition.md) · [ctrlMapAnimAdd](../commands/ctrlMapAnimAdd.md) · [ctrlCreate](../commands/ctrlCreate.md)

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