ctrlSetTextSelection: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Command " to "{{RV|type=command ")
m (Text replacement - "\{\{( *)Informative( *)\|" to "{{$1Feature$2|$2Informative$2|")
Line 8: Line 8:


|Selects <tt>length</tt> characters of edit control from the <tt>start</tt> position and places cursor at the end of selection.
|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)}}
{{Feature | 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)}}


| control [[ctrlSetTextSelection]] [start, length]
| control [[ctrlSetTextSelection]] [start, length]

Revision as of 00:09, 7 February 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
GUI Control

Syntax

Syntax:
Syntax needed
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:
Return value needed

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:
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