ctrlSetTextSelection: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "|gr1= GUI Control |GROUP1= ||gr1= GUI Control|GROUP1=" to "|gr1= GUI Control |GROUP1=") |
Killzone Kid (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|Selects | |Selects <tt>length</tt> characters of edit control from the <tt>start</tt> position and places cursor at the end of selection. | ||
{{Informative | To move cursor only, set <tt>length</tt> to 0. To select text from right to left, use negative <tt>length</tt> (See [[ctrlTextSelection]] for more info)}} |DESCRIPTION= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 18: | Line 19: | ||
|p2= [start, length]: [[Array]] |PARAMETER2= | |p2= [start, length]: [[Array]] |PARAMETER2= | ||
|p3= start: [[Number]] - selection start position |PARAMETER3= | |p3= start: [[Number]] - selection start position |PARAMETER3= | ||
|p4= length: [[Number]] - length of characters to select (0 to only move the cursor) |PARAMETER4= | |p4= length: [[Number]] - length of characters to select (0 to only move the cursor). Negative length will select text from right to left (see example 3) |PARAMETER4= | ||
| [[Nothing]] |RETURNVALUE= | | [[Nothing]] |RETURNVALUE= | ||
Line 33: | Line 34: | ||
_ctrl [[ctrlSetTextSelection]] [6, 5]; // selects World | _ctrl [[ctrlSetTextSelection]] [6, 5]; // selects World | ||
[[ctrlSetFocus]] _ctrl;</code>|EXAMPLE2= | [[ctrlSetFocus]] _ctrl;</code>|EXAMPLE2= | ||
|x3= Select text from right to left:<code>_control [[ctrlSetTextSelection]] [5, -4]</code>|EXAMPLE3= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Revision as of 01:42, 9 October 2020
Description
- Description:
- Selects length characters of edit control from the start position and places cursor at the end of selection.
- Groups:
- GUI Control
Syntax
- Syntax:
- control ctrlSetTextSelection [start, length]
- Parameters:
- control: Control
- [start, length]: Array
- start: Number - selection start position
- length: Number - length of characters to select (0 to only move the cursor). Negative length will select text from right to left (see example 3)
- Return Value:
- Nothing
Examples
- Example 1:
_control ctrlSetTextSelection [5, 10]
- Example 2:
disableSerialization; private _ctrl = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscEditMulti", -1]; _ctrl ctrlSetPosition [0,0,0.5,0.3]; _ctrl ctrlCommit 0; _ctrl ctrlSetText "Hello World"; _ctrl ctrlSetTextSelection [6, 5]; // selects World ctrlSetFocus _ctrl;
- Example 3:
- Select text from right to left:
_control ctrlSetTextSelection [5, -4]
Additional Information
- See also:
- ctrlTextSelection ctrlSetText
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
[[Category:Introduced with arma3dev version 1.99]][[ Category: arma3dev: New Scripting Commands | CTRLSETTEXTSELECTION]][[ Category: arma3dev: Scripting Commands | CTRLSETTEXTSELECTION]]