beetlebug▾
/

entry selection

Reads or changes the selected text of the entry.

PATHNAME selection adjust INDEX
PATHNAME selection clear
PATHNAME selection from INDEX
PATHNAME selection present
PATHNAME selection range START END
PATHNAME selection to INDEX

Description

Each form works on the selection of the entry:

Returns

1 or 0 for present, and an empty string for the other forms.

Examples

% entry .se
> .se insert 0 abcdef
> .se selection range 1 3
> list [.se index sel.first] [.se index sel.last]
1 3

% entry .se2
> .se2 insert 0 abcdef
> .se2 selection from 2
> .se2 selection to 4
> .se2 selection present
1

% entry .se3
> .se3 insert 0 abcdef
> .se3 selection range 0 2
> .se3 selection clear
> .se3 selection present
0

Errors

% entry .se4; .se4 selection bogus
bad selection option "bogus": must be adjust, clear, from, present, range, or to
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also