ctrlSetPosition: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "{{Command " to "{{RV|type=command ") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *PARAMETER[0-9]{1,3} *= * " to " ") |
||
Line 19: | Line 19: | ||
| s2= controlName '''ctrlSetPosition''' [x, y, w, h] | | s2= controlName '''ctrlSetPosition''' [x, y, w, h] | ||
|p21= controlName: [[Control]] - 2D control | |p21= controlName: [[Control]] - 2D control | ||
|p22= [x, y, w, h]: [[Array]] | |p22= [x, y, w, h]: [[Array]] | ||
|r2= [[Nothing]] | |r2= [[Nothing]] | ||
Line 27: | Line 27: | ||
|s3= controlName '''ctrlSetPosition''' [x, y, z] | |s3= controlName '''ctrlSetPosition''' [x, y, z] | ||
|p41= controlName: [[Control]] - 3D control | |p41= controlName: [[Control]] - 3D control | ||
|p42= [x, y, z]: [[Array]] - y is distance from the screen | |p42= [x, y, z]: [[Array]] - y is distance from the screen | ||
|r3= [[Nothing]] | |r3= [[Nothing]] |
Revision as of 18:16, 29 January 2021
Description
- Description:
- Description needed
- Groups:
- GUI Control
Syntax 1
- Syntax:
- Syntax needed
- Parameters:
- controlName: Control - 2D control
- [x, y]: Array
- Return Value:
- Return value needed
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 " "]; 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:
- See also needed
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)