Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version

set-selection

Arguments: stream start &optional (end start) &key (scroll t)

Sets the selected text in stream, which must be a text-edit-pane or a text control (such as an editable-text or multi-line-editable-text), to be the characters indexed by start (inclusive) and end (exclusive). If start equals end, the cursor is placed before the character at start, but no text is selected. Indexing is zero-based so the first character is index 0. The end of the buffer may be specified by passing start or end as a very large integer such as the value of most-positive-fixnum. If end is nil or unspecified, it will default to start.

If scroll is true, as it is by default, and the newly selected text (or text cursor position) is not currently scrolled into view, then it will be scrolled into view automatically. If you wish to specify scroll as nil, you must provide a value for end. nil is a suitable value if you do not otherwise intend to specify one.

Since a text-edit-pane is a stream, the function file-position may alternately be used to return or set its text cursor position, and file-length will return the index of the end of the buffer. (Calling window on a multi-line-editable-text widget will return its associated text-edit-pane.)

This function also works on editor buffers (instances of lisp-edit-pane). For a simple test of this function, open an editor window (click View | New Editor if necessary). Click on Tools | Get Component and click on the editor pane. The object will be returned in the Debug Window. In the Debug Window, evaluate

(setq lp *)

Now, in the editor pane, enter

0123456789
0123456789

(with no spaces).

(set-selection lp 0 2) selects 01 in the first line.

(set-selection lp 0 10) selects all characters in the first line.

(set-selection lp 0 13) selects all the first line and 0 in the second line. (the 11th and 12th characters are the carriage-return and linefeed).

See also get-selection.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version