ctrlSetTextSelection: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "") |
Lou Montana (talk | contribs) 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 | {{Command | ||
| arma3 | | arma3 | ||
|2.00 | |2.00 | ||
|gr1= GUI Control | |gr1= GUI Control | ||
|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)}} | {{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] | ||
|p1= control: [[Control]] | |p1= control: [[Control]] | ||
|p2= [start, length]: [[Array]] | |p2= [start, length]: [[Array]] | ||
|p3= start: [[Number]] - selection start position | |p3= start: [[Number]] - selection start position | ||
|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) | |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) | ||
| [[Nothing]] | | [[Nothing]] | ||
|x1= <code>_control [[ctrlSetTextSelection]] [5, 10]</code> | |x1= <code>_control [[ctrlSetTextSelection]] [5, 10]</code> | ||
|x2= <code>[[disableSerialization]]; | |x2= <code>[[disableSerialization]]; | ||
Line 29: | Line 29: | ||
_ctrl [[ctrlSetText]] "Hello World"; | _ctrl [[ctrlSetText]] "Hello World"; | ||
_ctrl [[ctrlSetTextSelection]] [6, 5]; // selects World | _ctrl [[ctrlSetTextSelection]] [6, 5]; // selects World | ||
[[ctrlSetFocus]] _ctrl;</code> | [[ctrlSetFocus]] _ctrl;</code> | ||
|x3= Select text from right to left:<code>_control [[ctrlSetTextSelection]] [5, -4]</code> | |x3= Select text from right to left:<code>_control [[ctrlSetTextSelection]] [5, -4]</code> | ||
| [[ctrlTextSelection]] [[ctrlSetText]] | | [[ctrlTextSelection]] [[ctrlSetText]] | ||
}} | }} |
Revision as of 00:29, 18 January 2021
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