canvas select
Reads or changes the selected text of a text item.
PATHNAME select adjust TAGORID INDEX
PATHNAME select clear
PATHNAME select from TAGORID INDEX
PATHNAME select item
PATHNAME select to TAGORID INDEX
Description
A canvas has at most one selection, in one text item:
adjust: moves the end of the selection that is nearer to INDEX to INDEX.clear: removes the selection.from: sets the anchor of the selection at INDEX of the item.item: gives the ID of the item with the selection, or an empty string.to: selects the characters between the anchor and INDEX.
Returns
An item ID for item, else an empty string.
Examples
% canvas .sl
> .sl create text 10 10 -text abcdef
> .sl select from 1 1
> .sl select to 1 3
> list [.sl select item] [.sl index 1 sel.first] [.sl index 1 sel.last]
1 1 3
Errors
% canvas .sl2; .sl2 select bogus
bad select option "bogus": must be adjust, clear, from, item, or to
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1