ctrlSetTextSelection: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ |()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}") |
Lou Montana (talk | contribs) m (Text replacement - "<tt>([a-zA-Z0-9\. _"']+)<\/tt>" to "{{hl|$1}}") |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma3 | |game1= arma3 | ||
|version1= 2.00 | |||
|2.00 | |||
|gr1= GUI Control | |gr1= GUI Control | ||
|Selects | |descr=Selects {{hl|length}} characters of edit control from the {{hl|start}} position and places cursor at the end of selection. | ||
{{Feature | Informative | To move cursor only, set | {{Feature | Informative | To move cursor only, set {{hl|length}} to 0. To select text from right to left, use negative {{hl|length}} (See [[ctrlTextSelection]] for more info)}} | ||
| control [[ctrlSetTextSelection]] [start, length] | |s1= control [[ctrlSetTextSelection]] [start, length] | ||
|p1= control: [[Control]] | |p1= control: [[Control]] | ||
Line 18: | Line 17: | ||
|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]] | |r1= [[Nothing]] | ||
|x1= <code>_control [[ctrlSetTextSelection]] [5, 10]</code> | |x1= <code>_control [[ctrlSetTextSelection]] [5, 10]</code> | ||
|x2= <code>[[disableSerialization]]; | |x2= <code>[[disableSerialization]]; | ||
[[private]] _ctrl = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscEditMulti", -1]; | [[private]] _ctrl = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscEditMulti", -1]; | ||
_ctrl [[ctrlSetPosition]] [0,0,0.5,0.3]; | _ctrl [[ctrlSetPosition]] [0,0,0.5,0.3]; | ||
_ctrl [[ctrlCommit]] 0; | _ctrl [[ctrlCommit]] 0; | ||
_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> | ||
Line 34: | Line 33: | ||
|seealso= [[ctrlTextSelection]] [[ctrlSetText]] | |seealso= [[ctrlTextSelection]] [[ctrlSetText]] | ||
}} | }} | ||
Revision as of 23:44, 15 November 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