Reports the position of the first selected character in an editable control.
DataWindow, EditMask, MultiLineEdit, SingleLineEdit, RichTextEdit, DropDownListBox, and DropDownPictureListBox controls
editname.SelectedStart ( )
Argument |
Description |
---|---|
editname |
The name of the control in which you want to determine the starting position of selected text. For a DataWindow, it reports the starting position in the edit control over the current row and column. |
Long. Returns the starting position of the selected text in editname. If no text is selected, SelectedStart returns the position of the character immediately following the insertion point. If an error occurs, SelectedStart returns -1. If editname is null, SelectedStart returns null.
For all controls except RichTextEdit, SelectedStart counts from the start of the text and includes spaces and line endings.
For RichTextEdit controls, SelectedStart counts from the start of the line on which the selection begins. The start is at the opposite end of the selection from the insertion point. For example, if the user dragged back to make the selection, the start of the selection is at the end of the highlighted text and the insertion point is before the start. Use the Position function to get information about the start and end of the selection.
Focus and the selection in a drop-down list When a DropDownListBox or DropDownPictureListBox loses focus, the selected text is no longer selected.
If the
MultiLineEdit mle_Comment contains Closed
for Vacation July 3 to July 10
, and Vacation
is
selected, then this example sets li_Start to 12
(the position of the first character in Vacation
):
integer li_Start
li_Start = mle_Comment.SelectedStart()