spinbox selection
Reads or changes the selected text of the spinbox.
PATHNAME selection adjust INDEX
PATHNAME selection clear
PATHNAME selection element ?ELEMENT?
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 spinbox:
adjust: moves the end of the selection that is nearer to INDEX to INDEX, and makes the other end the anchor.clear: removes the selection.element: with no ELEMENT, gives the selected arrow:buttonup,buttondown, ornone. With ELEMENT, selects that arrow.from: sets the anchor at INDEX.present: gives 1 when the spinbox has a selection, and 0 when it has none.range: selects the characters from START up to the character before END.to: selects the characters between the anchor and INDEX.
Returns
1 or 0 for present, an element for element with no ELEMENT, and an empty string for the other forms.
Examples
% spinbox .se
> .se insert 0 abcdef
> .se selection range 1 3
> list [.se index sel.first] [.se index sel.last]
1 3
% spinbox .se2
> .se2 insert 0 abcdef
> .se2 selection from 2
> .se2 selection to 4
> .se2 selection present
1
% spinbox .se3
> .se3 insert 0 abcdef
> .se3 selection range 0 2
> .se3 selection clear
> .se3 selection present
0
% spinbox .se5
> .se5 selection element buttonup
> .se5 selection element
buttonup
Errors
% spinbox .se4; .se4 selection bogus
bad selection option "bogus": must be adjust, clear, element, from, present, range, or to
-errorcode NONE
% spinbox .se6; .se6 selection element bogus
bad selection element "bogus": must be none, buttondown, or buttonup
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1