beetlebug▾
/

listbox itemconfigure

Gives or sets the options of one item.

PATHNAME itemconfigure INDEX ?OPTION? ?VALUE? ?OPTION VALUE ...?

Description

With no OPTION, gives a list with an entry for each option of the item. With one OPTION, gives its entry: the option, two empty strings, an empty default, and the value. With pairs of options and values, sets each option of the item.

The options of an item are -background (-bg), -foreground (-fg), -selectbackground, and -selectforeground. Each one is a color, and an empty value uses the option of the listbox.

Returns

An entry, a list of entries, or an empty string.

Examples

% listbox .icf
> .icf insert end a
> .icf itemconfigure 0 -background yellow
> .icf itemconfigure 0 -background
-background {} {} {} yellow

Errors

% listbox .icf2; .icf2 insert end a; .icf2 itemconfigure 0 -foo 1
unknown option "-foo"
-errorcode NONE

% listbox .icf3; .icf3 itemconfigure 2 -bg red
item number "2" out of range
-errorcode NONE

Facts

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

See also