The contents of an SftMask control are selected with the keyboard and the mouse as in an edit control: Shift with the arrow keys, Home and End, Ctrl+A, double-clicking a word (the characters up to the next space or empty position), dragging, or clicking with Shift. In overtype mode, the character at the caret is selected (see Input Modes).
The SftMask.SelectionStart, SftMask.SelectionLength and SftMask.SelectedText properties and the SftMask.Select, SftMask.SelectAll and SftMask.DeselectAll methods read and set the selection in code. Positions count every position of the mask, literals included. As in a TextBox, SftMask.SelectionStart is the first selected position (the caret when nothing is selected) and SftMask.SelectionLength the number of selected positions; SftMask.Select with a negative length selects the positions before the start and places the caret at the beginning of the selection. SftMask.SelectedText returns the selection in the form defined by the SftMask.ClipboardFormat property; setting it replaces the selection, entered like a text set by the application. The SftMask.ScrollToCaret method scrolls the contents so the caret is visible.
The SftMask.EntrySelect property defines what is selected when the control receives the input focus:
| Value | Description |
|---|---|
| EntrySelectEnum.None | The selection is not changed. |
| EntrySelectEnum.All | All of the contents are selected. When the control is empty, the caret is placed at the first input position. This is the default. |
| EntrySelectEnum.EndHome | The contents are selected from the end to the first input position; the caret is at the first input position. |
| EntrySelectEnum.HomeEnd | The contents are selected from the first input position to the end; the caret is at the end. |
| EntrySelectEnum.Home | The caret is placed at the first input position. |
| EntrySelectEnum.End | The caret is placed at the end. |
The SftMask.EntrySelectMouse property defines whether the EntrySelect property is also used when a mouse click gives the control the input focus (the default); otherwise the click places the caret.
The SftMask.HideSelection property hides the selection while the control does not have the input focus (the default). The SftMask.SelectionBackColor and SftMask.SelectionForeColor properties define the colors of the selection, the SftMask.FocusSelectionBackColor and SftMask.FocusSelectionForeColor properties its colors while the control has the input focus (see Appearance).