{"name":"ctrlMapSetPosition","operator":null,"title":"ctrlMapSetPosition","type":"command","url":"https://community.bistudio.com/wiki/ctrlMapSetPosition","revid":352027,"updated":"2024-02-01T23:24:23Z","groups":["GUI Control - Map"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.06"}],"since":{"game":"arma3","name":"Arma 3","version":"2.06"},"arma3_since":"2.06","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Sets position and size of the given map control and recalculates control center. The effect is immediate and no ctrlCommit is necessary, unlike with ctrlSetPosition command.\n\n> [!NOTE]\n> 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. 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).","syntaxes":[{"syntax":"map ctrlMapSetPosition [x, y, w, h]","since":null,"effect":null,"exec":null,"params":[{"name":"map","type":"Control","optional":false,"default":null,"description":"Map control","types":["Control"],"since":null,"text":"map: Control - Map control"},{"name":"x","type":"Number","optional":true,"default":null,"description":"Left top x of map control","types":["Number"],"since":null,"text":"x: Number - (Optional) Left top x of map control"},{"name":"y","type":"Number","optional":true,"default":null,"description":"Left top y of map control","types":["Number"],"since":null,"text":"y: Number - (Optional) Left top y of map control"},{"name":"w","type":"Number","optional":true,"default":null,"description":"Width of map control","types":["Number"],"since":null,"text":"w: Number - (Optional) Width of map control"},{"name":"h","type":"Number","optional":true,"default":null,"description":"Height of map control","types":["Number"],"since":null,"text":"h: Number - (Optional) Height of map control"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"map","types":["Control"]},"right":{"text":"[x, y, w, h]","types":["Array"]}}],"examples":[{"text":"```sqf\n_map ctrlMapSetPosition [0,0,1,1];\n```","code":["_map ctrlMapSetPosition [0,0,1,1];"]},{"text":"```sqf\n_map ctrlSetPosition [0.5, 0.5, 0.5, 0.5];\n_map ctrlCommit 0;\n_map ctrlMapSetPosition []; // sync\n```","code":["_map ctrlSetPosition [0.5, 0.5, 0.5, 0.5];\n_map ctrlCommit 0;\n_map ctrlMapSetPosition []; // sync"]},{"text":"```sqf\nwith localNamespace do\n{\n    private _display = findDisplay 46 createDisplay \"RscDisplayEmpty\";\n    private _ctrlGroup = _display ctrlCreate [\"RscControlsGroup\", -1];\n    private _ctrlText = _display ctrlCreate [\"RscText\", -1, _ctrlGroup];\n    _ctrltext ctrlSetPosition [0, 0, 1, 1];\n    _ctrlText ctrlSetBackgroundColor [1, 0, 0, 0.5];\n    _ctrlText ctrlCommit 0;\n    private _ctrlMap = _display ctrlCreate [\"RscMapControl\", -1, _ctrlGroup];\n    _ctrlMap ctrlMapSetPosition [0, 0, 0.5, 0.5]; // effect is immediate\n    _ctrlMap ctrlMapAnimAdd [0, ctrlMapScale _ctrlMap, player];\n    ctrlMapAnimCommit _ctrlMap;\n    _ctrlGroup ctrlSetPosition [safeZoneX, safeZoneY, 1, 1];\n    _ctrlGroup ctrlCommit 0.3; // non instant transition\n    _ctrlMap ctrlMapSetPosition []; // instant sync to new _ctrlGroup position\n};\n```","code":["with localNamespace do\n{\n\tprivate _display = findDisplay 46 createDisplay \"RscDisplayEmpty\";\n\tprivate _ctrlGroup = _display ctrlCreate [\"RscControlsGroup\", -1];\n\tprivate _ctrlText = _display ctrlCreate [\"RscText\", -1, _ctrlGroup];\n\t_ctrltext ctrlSetPosition [0, 0, 1, 1];\n\t_ctrlText ctrlSetBackgroundColor [1, 0, 0, 0.5];\n\t_ctrlText ctrlCommit 0;\n\tprivate _ctrlMap = _display ctrlCreate [\"RscMapControl\", -1, _ctrlGroup];\n\t_ctrlMap ctrlMapSetPosition [0, 0, 0.5, 0.5]; // effect is immediate\n\t_ctrlMap ctrlMapAnimAdd [0, ctrlMapScale _ctrlMap, player];\n\tctrlMapAnimCommit _ctrlMap;\n\t_ctrlGroup ctrlSetPosition [safeZoneX, safeZoneY, 1, 1];\n\t_ctrlGroup ctrlCommit 0.3; // non instant transition\n\t_ctrlMap ctrlMapSetPosition []; // instant sync to new _ctrlGroup position\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["ctrlMapPosition","ctrlSetPosition","ctrlMapAnimAdd","ctrlCreate"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: GUI Control - Map","Introduced with Arma 3 version 2.06","Scripting Commands"]}