This is request for the addition of scripting commands to control the cursor and selection in edit box controls (CT_EDIT). These commands may work as follows:
ctrlCursorPos
Description: Returns the index of the cursor (where 0 means the cursor is in front of the first character) in the given edit box control. -1 is returned if control is not an edit box. If the control is not in focus or is disabled, returns the index the cursor would be at if it gained focus.
Syntax: ctrlCursorPos control
- control <CONTROL>
Return Value: Index of the cursor in the given edit box control. -1 if the control is not an edit box. <NUMBER>
ctrlSetCursorPos
Description: Sets the position of the cursor to the given index in the given edit box control. Does not require the edit box to be in focus or enabled. If an index greater than the length of the text in the edit box is given, the cursor position is set to the last possible index. Negative indices set the cursor to the first possible position.
Syntax: control ctrlSetCursorPos index
- control <CONTROL>
- index <NUMBER>
Return Value: Nothing.
ctrlSelection
Description: Returns the starting index of (in the same manner as the above commands) and length (number of characters) of the current selection in the given edit box control. [0, 0] is returned if no selection is currently active or if the control is not an edit box.
Syntax: ctrlSelection control
- control <CONTROL>
Return Value: Starting index and length (number of characters) of the current selection in the given edit box control [start, length]. [0, 0] is returned if no selection is currently active or if the control is not an edit box.
- start <NUMBER>
- length <NUMBER>
ctrlSetSelection
Description: Sets the current selection from the starting index to the given length (number of characters) in the given edit box control. [0, 0] (or any combination of starting index and zero length) will clear the selection. When the length is omitted, the selection is set from the starting index to after the last character in the edit box. A length greater than the maximum number of selectable characters from the starting index will select all characters until the end. Negative starting indices are treated as the first possible index - 0.
Syntax: control ctrlSetSelection [start, length]
- control <CONTROL>
- start: starting index of the selection <NUMBER>
- length: number of characters to select. optional, when omitted, selection is made up to, and including, the last character <NUMBER>
Return Value: Nothing.