Futurebasic/Language/Reference/setselect

SETSELECT

edit

Syntax

edit

SETSELECT startSelect%,endSelect%

Description

edit

If the current output window contains an active edit field, this statement selects (highlights) a range of text in the field, or sets the position of the blinking insertion point. It also scrolls the selected text into view, if it's not already in view.

The startSelect% and endSelect% parameters refer to positions between characters in the field. Position 0 is just to the left of the first character; position 1 is between the first and second characters; and so on. If you specify a position greater than or equal to the number of characters in the field, it indicates a position just to the right of the last character. If startSelect% equals endSelect%, then no text is highlighted, but a blinking insertion point is paced at the indicated position.

Example

edit
If you specify <code><b>SETSELECT</b> 0,0</code>, a blinking insertion point is placed at the beginning of the field's text. If you specify <code><b>SETSELECT</b> 0,32767</code>, all of the text in the field is selected. If you specify <code><b>SETSELECT</b> 32767,32767</code>, a blinking insertion point is placed at the end of the field's text.

The following inserts or replaces the selected range with the contents of <code>newString$</code>:

<code><b>SETSELECT</b> startSelect%, endSelect%
TEKEY$ = newString$</code>

Note: Text selection and insertion-pont placement are normally handled automatically by the HANDLEEVENTS statement, in response to the user's mouse and keyboard actions. Use SETSELECT for special situations.

Use the WINDOW(_selStart) and WINDOW(_selEnd) functions to determine the active field's current selection range.

FB Lite behavior: When you use the "FB Lite" runtime, SETSELECT switches to the Text Window, then highlights the indicated range of characters in the window.

See Also

edit

EDIT FIELD; TEKEY$ statement; WINDOW function; TEHANDLE