ctrlMapSetPosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *game([0-9]) *= *[aA]rma +3 * " to "|game$1= arma3 ")
m (Text replacement - "{{Feature|Informative|" to "{{Feature|informative|")
 
(9 intermediate revisions by 3 users not shown)
Line 5: Line 5:


|gr1= GUI Control - Map
|gr1= GUI Control - Map
|branch= dev


|descr= 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.
|descr= 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.
{{Feature|Informative|The [[CT_MAP|Map control]] is different from other controls and normally does not behave well inside [[CT_CONTROLS_GROUP|Controls Groups]]. When this command is used on the [[CT_MAP|Map control]] inside a [[CT_CONTROLS_GROUP|Controls Group]], The ''x'' and ''y'' will be treated as relative position to the top left of [[CT_CONTROLS_GROUP|Controls Group]]. Use this command to set position before you use [[ctrlMapAnimAdd]]. Use this command to update [[CT_MAP|Map control]] after its position or size had been changed or the [[CT_MAP|Map control]] was created dynamically (Example 2). If you move [[CT_CONTROLS_GROUP|Controls Group]], use this command to refresh [[CT_MAP|Map control]] (Example 3). }}
{{Feature|informative|The [[CT_MAP|Map control]] is different from other controls and normally does not behave well inside [[CT_CONTROLS_GROUP|Controls Groups]]. When this command is used on the [[CT_MAP|Map control]] inside a [[CT_CONTROLS_GROUP|Controls Group]], The ''x'' and ''y'' will be treated as relative position to the top left of [[CT_CONTROLS_GROUP|Controls Group]]. Use this command to set position before you use [[ctrlMapAnimAdd]]. Use this command to update [[CT_MAP|Map control]] after its position or size had been changed or the [[CT_MAP|Map control]] was created dynamically (Example 2). If you move [[CT_CONTROLS_GROUP|Controls Group]], use this command to refresh [[CT_MAP|Map control]] (Example 3). }}


|s1= map [[ctrlMapSetPosition]] [x, y, w, h]
|s1= map [[ctrlMapSetPosition]] [x, y, w, h]


|p1= map: - [[Control]] - [[CT_MAP|Map control]]
|p1= map: [[Control]] - [[CT_MAP|Map control]]
|p2= [x, y, w, h] - [[Array]]
 
|p3=  x: - [[Number]] - (Optional) Left top x of map control  
|p2= x: [[Number]] - (Optional) Left top x of map control  
|p4= y: - [[Number]] - (Optional) Left top y of map control
 
|p5= w: - [[Number]] - (Optional) Width of map control
|p3= y: [[Number]] - (Optional) Left top y of map control
|p6= h: - [[Number]] - (Optional) Height of map control
 
|p4= w: [[Number]] - (Optional) Width of map control
 
|p5= h: [[Number]] - (Optional) Height of map control


|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code>_map [[ctrlMapSetPosition]] [0,0,1,1];</code>
|x1= <sqf>_map ctrlMapSetPosition [0,0,1,1];</sqf>


|x2= <code>_map [[ctrlSetPosition]] [0.5, 0.5, 0.5, 0.5];
|x2= <sqf>
_map [[ctrlCommit]] 0;
_map ctrlSetPosition [0.5, 0.5, 0.5, 0.5];
_map [[ctrlMapSetPosition]] []; {{cc|Sync}}</code>
_map ctrlCommit 0;
_map ctrlMapSetPosition []; // sync
</sqf>


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


|seealso= [[ctrlSetPosition]], [[ctrlMapAnimAdd]], [[ctrlCreate]]
|seealso= [[ctrlMapPosition]] [[ctrlSetPosition]] [[ctrlMapAnimAdd]] [[ctrlCreate]]
}}
}}

Latest revision as of 00:24, 2 February 2024

Hover & click on the images for description

Description

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.
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).
Groups:
GUI Control - Map

Syntax

Syntax:
map ctrlMapSetPosition [x, y, w, h]
Parameters:
map: Control - Map control
x: Number - (Optional) Left top x of map control
y: Number - (Optional) Left top y of map control
w: Number - (Optional) Width of map control
h: Number - (Optional) Height of map control
Return Value:
Nothing

Examples

Example 1:
_map ctrlMapSetPosition [0,0,1,1];
Example 2:
_map ctrlSetPosition [0.5, 0.5, 0.5, 0.5]; _map ctrlCommit 0; _map ctrlMapSetPosition []; // sync
Example 3:
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 };

Additional Information

See also:
ctrlMapPosition ctrlSetPosition ctrlMapAnimAdd ctrlCreate

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note