ctrlSetPosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 1: Line 1:
{{Command|Comments=
{{Command


| arma1 |Game name=
| arma1


|1.00|Game version=
|1.00


|gr1= GUI Control |GROUP1=
|gr1= GUI Control


| Sets wanted position and size for 2D control animation. Width and height are optional. [[ctrlCommit]] is required to complete the operation. For 3D control, param is relative [x,y,z] and no [[ctrlCommit]] is required as it cannot be animated. |DESCRIPTION=
| Sets wanted position and size for 2D control animation. Width and height are optional. [[ctrlCommit]] is required to complete the operation. For 3D control, param is relative [x,y,z] and no [[ctrlCommit]] is required as it cannot be animated.


| controlName '''ctrlSetPosition''' [x, y] |SYNTAX=
| controlName '''ctrlSetPosition''' [x, y]


|p1=  controlName: [[Control]] - 2D control|PARAMETER1=
|p1=  controlName: [[Control]] - 2D control


|p2= [x, y]: [[Array]] |PARAMETER2=
|p2= [x, y]: [[Array]]


| [[Nothing]] |RETURNVALUE=
| [[Nothing]]




| s2= controlName '''ctrlSetPosition''' [x, y, w, h] |SYNTAX2=
| s2= controlName '''ctrlSetPosition''' [x, y, w, h]


|p21=  controlName: [[Control]] - 2D control|PARAMETER21=
|p21=  controlName: [[Control]] - 2D control|PARAMETER21=
Line 24: Line 24:
|p22= [x, y, w, h]: [[Array]] |PARAMETER22=
|p22= [x, y, w, h]: [[Array]] |PARAMETER22=


|r2= [[Nothing]] |RETURNVALUE2=
|r2= [[Nothing]]




|s3= controlName '''ctrlSetPosition''' [x, y, z] |SYNTAX3=
|s3= controlName '''ctrlSetPosition''' [x, y, z]


|p41=  controlName: [[Control]] - 3D control|PARAMETER41=
|p41=  controlName: [[Control]] - 3D control|PARAMETER41=
Line 33: Line 33:
|p42= [x, y, z]: [[Array]] - y is distance from the screen |PARAMETER42=
|p42= [x, y, z]: [[Array]] - y is distance from the screen |PARAMETER42=


|r3= [[Nothing]] |RETURNVALUE3=
|r3= [[Nothing]]
|x1= Move control: <code>_control2D [[ctrlSetPosition]] [0, 0];
|x1= Move control: <code>_control2D [[ctrlSetPosition]] [0, 0];
_control2D [[ctrlCommit]] 0;</code> |EXAMPLE1=
_control2D [[ctrlCommit]] 0;</code>
   
   
|x2= Move control and resize:<code>_control2D [[ctrlSetPosition]] [0, 0, 1, 1];
|x2= Move control and resize:<code>_control2D [[ctrlSetPosition]] [0, 0, 1, 1];
_control2D [[ctrlCommit]] 0;</code> |EXAMPLE2=
_control2D [[ctrlCommit]] 0;</code>


|x3= <code>_control3D [[ctrlSetPosition]] [0.5, 1, 0.5]; //centered and 1m away from screen</code> |EXAMPLE3=
|x3= <code>_control3D [[ctrlSetPosition]] [0.5, 1, 0.5]; //centered and 1m away from screen</code>


|x4= Typewriter effect: <code>[[with]] [[uiNamespace]] [[do]]
|x4= Typewriter effect: <code>[[with]] [[uiNamespace]] [[do]]
Line 81: Line 81:
[[ctrlDelete]] ctrl;
[[ctrlDelete]] ctrl;
};
};
};</code>|EXAMPLE4=
};</code>


| [[ctrlCommit]], [[ctrlCreate]], [[ctrlDelete]], [[ctrlModel]], [[ctrlSetModel]], [[ctrlPosition]], [[ctrlClassName]], [[displayCtrl]], [[ctrlModelScale]], [[ctrlSetModelScale]], [[ctrlModelDirAndUp]], [[ctrlSetModelDirAndUp]] |SEEALSO=
| [[ctrlCommit]], [[ctrlCreate]], [[ctrlDelete]], [[ctrlModel]], [[ctrlSetModel]], [[ctrlPosition]], [[ctrlClassName]], [[displayCtrl]], [[ctrlModelScale]], [[ctrlSetModelScale]], [[ctrlModelDirAndUp]], [[ctrlSetModelDirAndUp]]
}}
}}



Revision as of 01:27, 18 January 2021

Hover & click on the images for description

Description

Description:
Sets wanted position and size for 2D control animation. Width and height are optional. ctrlCommit is required to complete the operation. For 3D control, param is relative [x,y,z] and no ctrlCommit is required as it cannot be animated.
Groups:
GUI Control

Syntax 1

Syntax:
controlName ctrlSetPosition [x, y]
Parameters:
controlName: Control - 2D control
[x, y]: Array
Return Value:
Nothing

Syntax 2

Syntax:
controlName ctrlSetPosition [x, y, w, h]
Parameters:
controlName: Control - 2D control
[x, y, w, h]: Array
Return Value:
Nothing

Syntax 3

Syntax:
controlName ctrlSetPosition [x, y, z]
Parameters:
controlName: Control - 3D control
[x, y, z]: Array - y is distance from the screen
Return Value:
Nothing

Examples

Example 1:
Move control: _control2D ctrlSetPosition [0, 0]; _control2D ctrlCommit 0;
Example 2:
Move control and resize:_control2D ctrlSetPosition [0, 0, 1, 1]; _control2D ctrlCommit 0;
Example 3:
_control3D ctrlSetPosition [0.5, 1, 0.5]; //centered and 1m away from screen
Example 4:
Typewriter effect: with uiNamespace do { [] spawn { _text1 = "This is a simple demo of typewriter text effect with various speed."; _text2 = "This took 10 seconds."; _text3 = "This is a fast one, set for 2 seconds."; ctrl = findDisplay 46 ctrlCreate ["RscStructuredText", -1]; ctrl ctrlSetPosition [0,0,0,0.1]; ctrl ctrlCommit 0; ctrl ctrlSetStructuredText parseText format ["<t color='#ff0000' size='2.1'>%1</t>", _text1 splitString " " joinString "&#160;"]; ctrl ctrlSetPosition [0,0,ctrlTextWidth ctrl,0.1]; ctrl ctrlCommit 8; waitUntil {ctrlCommitted ctrl}; sleep 0.5; ctrl ctrlSetPosition [0,0,0,0.1]; ctrl ctrlCommit 0; ctrl ctrlSetStructuredText parseText format ["<t color='#ff0000' size='2.1'>%1</t>", _text2 splitString " " joinString "&#160;"]; ctrl ctrlSetPosition [0,0,ctrlTextWidth ctrl,0.1]; ctrl ctrlCommit 2; waitUntil {ctrlCommitted ctrl}; sleep 2; ctrl ctrlSetPosition [0,0,0,0.1]; ctrl ctrlCommit 0; ctrl ctrlSetStructuredText parseText format ["<t color='#00ff00' size='2.1'>%1</t>", _text3 splitString " " joinString "&#160;"]; ctrl ctrlSetPosition [0,0,ctrlTextWidth ctrl,0.1]; ctrl ctrlCommit 2; waitUntil {ctrlCommitted ctrl}; sleep 2; ctrlDelete ctrl; }; };

Additional Information

See also:
ctrlCommitctrlCreatectrlDeletectrlModelctrlSetModelctrlPositionctrlClassNamedisplayCtrlctrlModelScalectrlSetModelScalectrlModelDirAndUpctrlSetModelDirAndUp

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
Posted on May 22, 2017 - 23:04 (UTC)
Lucian
If the target ctrl is part of a ctrlGroup, the position needs to be relative to the ctrlGroup position.
Posted on July 20, 2017 - 11:56 (UTC)
Yuval
If the target control is a controls' group, all the child controls of that group will be moved automatically (as their position is relative to the control group rather than the display)