Link Search Menu Expand Document

TextBox.SetSelection Method

Explanation Set the cursor position and selection range.
If you have run-time focus, your specifications will take effect immediately.

Extension since Ver.5.0.2
If there is no focus at the time of execution, it will be in the execution reserved state and the specification will be reflected when the focus is acquired.

Added since Ver.5.0.0
Not supported in Mobile, AI
Call format TextBox1.SetSelection( pos [, length ] )
Return value None
Arguments integer pos Specify the cursor position starting from 0.
If you specify outside the range, it will be corrected within the range.
For other than UString, if the byte boundary of a 2-byte character is specified, it will be corrected to the previous byte.
integer length Specify the selected character length. If omitted, it will be 0 (no selection).

Unique specifications
  SetSelection (0, -1) Select all
  SetSelection (-1) Deselection
Exception None
Example of use
    TextBox1.SetSelection(1, 4);
    
Related item GetSelection method