ttk::treeview tag
Adds, removes, and lists the tags of items, and gives a tag a look and bindings.
PATHNAME tag add TAG ITEMLIST
PATHNAME tag remove TAG ?ITEMLIST?
PATHNAME tag has TAG ?ITEM?
PATHNAME tag names
PATHNAME tag configure TAG ?OPTION? ?VALUE OPTION VALUE ...?
PATHNAME tag bind TAG ?SEQUENCE? ?SCRIPT?
Description
add adds TAG to each item of ITEMLIST, and remove removes it from them, or from each item with no ITEMLIST. has gives the items with TAG, or with ITEM, 1 or 0. names gives each tag that an item or a tag configure uses.
configure gives or sets the options of a tag: -foreground, -background, -font, -image, -text, and -anchor. An item with the tag has that look. bind binds SCRIPT to an event SEQUENCE on the items with the tag, as bind does for a widget. A pointer event goes to the item under the pointer, and a key event to the focus item.
Returns
A list, a value, 1 or 0, or an empty string.
Examples
% ttk::treeview .ttvtg
> foreach id {a b} {.ttvtg insert {} end -id $id}
> .ttvtg tag add done {a b}
> .ttvtg tag remove done a
> list [.ttvtg tag has done] [.ttvtg tag has done a]
b 0
% ttk::treeview .ttvtg2
> .ttvtg2 tag configure warn -foreground red
> .ttvtg2 tag configure warn
-text {} -image {} -anchor {} -background {} -foreground red -font {}
% ttk::treeview .ttvtg3
> .ttvtg3 tag bind row <1> {set ::ttvclick 1}
> .ttvtg3 tag bind row
<Button-1>
Errors
% ttk::treeview .ttvtg4; .ttvtg4 tag bogus
bad command "bogus": must be add, bind, configure, has, names, or remove
-errorcode NONE
% ttk::treeview .ttvtg5; .ttvtg5 tag configure t -bogus 1
unknown option "-bogus"
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1