ctrlSetPosition: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ |()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}") |
(formatting and new command group) |
||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma1 | |game1= arma1 | ||
|1.00 | |version1= 1.00 | ||
| | |game2= arma2 | ||
| | |version2= 1.00 | ||
| controlName '''ctrlSetPosition''' [x, y] | |game3= arma2oa | ||
|version3= 1.51 | |||
|game4= tkoh | |||
|version4= 1.00 | |||
|game5= arma3 | |||
|version5= 0.50 | |||
|gr1= GUI Control - Positioning | |||
|descr= 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. If target control is inside a [[CT_CONTROLS_GROUP]], the position needs to be relative to it. | |||
|s1= controlName '''ctrlSetPosition''' [x, y] | |||
|p1= controlName: [[Control]] - 2D control | |p1= controlName: [[Control]] - 2D control | ||
|p2= | |p2= x: [[Number]] - Position in x | ||
| [[Nothing]] | |p3= y: [[Number]] - Position in y | ||
|r1= [[Nothing]] | |||
| s2= controlName '''ctrlSetPosition''' [x, y, w, h] | | s2= controlName '''ctrlSetPosition''' [x, y, w, h] | ||
Line 21: | Line 39: | ||
|p21= controlName: [[Control]] - 2D control | |p21= controlName: [[Control]] - 2D control | ||
|p22= [x | |p22= x: [[Number]] - Position in x | ||
|p23= y: [[Number]] - Position in y | |||
|p24= w: [[Number]] - Width of the control | |||
|p25= h: [[Number]] - Height of the control | |||
|r2= [[Nothing]] | |r2= [[Nothing]] | ||
Line 29: | Line 53: | ||
|p41= controlName: [[Control]] - 3D control | |p41= controlName: [[Control]] - 3D control | ||
|p42= [x | |p42= x: [[Number]] - Position in x | ||
|p43= y: [[Number]] - Position in y (Distance from the screen) | |||
|p44= z: [[Number]] - Position in z | |||
|r3= [[Nothing]] | |r3= [[Nothing]] | ||
|x1= Move control: <code>_control2D [[ctrlSetPosition]] [0, 0]; | |x1= Move control: <code>_control2D [[ctrlSetPosition]] [0, 0]; | ||
_control2D [[ctrlCommit]] 0;</code> | _control2D [[ctrlCommit]] 0;</code> | ||
Line 81: | Line 110: | ||
};</code> | };</code> | ||
|seealso= [[ctrlCommit]] | |seealso= [[ctrlCommit]] [[ctrlCreate]] [[ctrlDelete]] [[ctrlModel]] [[ctrlSetModel]] [[ctrlPosition]] [[ctrlClassName]] [[displayCtrl]] [[ctrlModelScale]] [[ctrlSetModelScale]] [[ctrlModelDirAndUp]] [[ctrlSetModelDirAndUp]] | ||
}} | }} | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<dd class="notedate">Posted on July 20, 2017 - 11:56 (UTC)</dd> | <dd class="notedate">Posted on July 20, 2017 - 11:56 (UTC)</dd> | ||
<dt class="note">[[User:Yuval|Yuval]]</dt> | <dt class="note">[[User:Yuval|Yuval]]</dt> | ||
Line 102: | Line 120: | ||
</dd> | </dd> | ||
</dl> | </dl> | ||
Revision as of 09:28, 5 March 2021
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. If target control is inside a CT_CONTROLS_GROUP, the position needs to be relative to it.
- Groups:
- GUI Control - Positioning
Syntax 1
- Syntax:
- controlName ctrlSetPosition [x, y]
- Parameters:
- controlName: Control - 2D control
- x: Number - Position in x
- y: Number - Position in y
- Return Value:
- Nothing
Syntax 2
- Syntax:
- controlName ctrlSetPosition [x, y, w, h]
- Parameters:
- controlName: Control - 2D control
- x: Number - Position in x
- y: Number - Position in y
- w: Number - Width of the control
- h: Number - Height of the control
- Return Value:
- Nothing
Syntax 3
- Syntax:
- controlName ctrlSetPosition [x, y, z]
- Parameters:
- controlName: Control - 3D control
- x: Number - Position in x
- y: Number - Position in y (Distance from the screen)
- z: Number - Position in z
- 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 " "]; 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 " "]; 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 " "]; ctrl ctrlSetPosition [0,0,ctrlTextWidth ctrl,0.1]; ctrl ctrlCommit 2; waitUntil {ctrlCommitted ctrl}; sleep 2; ctrlDelete ctrl; }; };
Additional Information
- See also:
- ctrlCommit ctrlCreate ctrlDelete ctrlModel ctrlSetModel ctrlPosition ctrlClassName displayCtrl ctrlModelScale ctrlSetModelScale ctrlModelDirAndUp ctrlSetModelDirAndUp
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 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)
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: GUI Control - Positioning