"select"

Selects the text of a text field. The complete text or only a specified number of characters can be selected.

Synopsis

shape.select(int P1, int P2);

Parameters

Parameter Description
shape Name of the text field
P1 Specifies the start position of the selection.
P2 Specifies the end position of the selection.

Description

The attribute "select" selects a range of text according to the given cursor positions. The value P1 defines the start position and the value P2 defines the end position of the selection and the cursor. Cursor positions start with 0, to the left of the first character.

If the start position is 0 and the end position is -1, the complete text will be selected.

If the start position is, for example, 0 and the end position is 5, the first five characters will be selected. The cursor is then placed after the 5th character.

If the start position is, for example, 4 and the end position is 2, the 3rd and 4th characters will be selected. The cursor is then placed after the 2nd character.

If the start position is -1, the text will be deselected.

Example

The following example selects the first six characters of the text "Select test".

main()
{
  this.text = "Select test";
  TextField1.select(0,6);
}

Assignment

Text field