[ Team LiB ] Previous Section Next Section

Listbox Attributes

Table 35-10 lists the listbox widget attributes. The table uses the resource name for the attribute, which has capitals at internal word boundaries. In Tcl commands these options are specified with a dash and all lowercase.

Table 35-10. Listbox attribute resource names

activeStyle

Display style of the active element: dotbox, underline (default), or none. (Tk 8.4)

background

Background color (also bg).

borderWidth

Extra space around the edge of the text.

cursor

Cursor to display when mouse is over the widget.

disabledForeground

Foreground color when the widget is disabled. (Tk 8.4)

exportSelection

If true, then the selected text is exported via the X selection mechanism.

font

Font for the text.

foreground

Foreground color (also fg).

height

Number of lines in the listbox.

highlightBackground

Focus highlight color when widget does not have focus.

highlightColor

Focus highlight color when widget has focus.

highlightThickness

Thickness of focus highlight rectangle.

listVariable

Name of Tcl variable containing a list whose value is synchronized with the widget, where each list element is a line of the listbox. (Tk 8.3)

relief

flat, sunken, raised, groove, solid, or ridge.

selectBackground

Background color of selection.

selectForeground

Foreground color of selection.

selectBorderWidth

Width of selection border. Nonzero for 3D effect.

selectMode

Mode: browse, single, extended, or multiple.

setGrid

Boolean. Set gridding attribute.

state

Widget state: normal or disabled. (Tk 8.4)

takeFocus

Controls focus changes from keyboard traversal.

width

Width, in average character sizes.

xScrollCommand

Connects listbox to a horizontal scrollbar.

yScrollCommand

Connects listbox to a vertical scrollbar.

Geometry Gridding

The setGrid attribute affects interactive resizing of the window containing the listbox. By default, a window can be resized to any size. If gridding is turned on, the size is restricted so that a whole number of lines and a whole number of average-width characters is displayed. Gridding affects the user feedback during an interactive resize. Without gridding the size is reported in pixel dimensions. When gridding is turned on, then the size is reported in gridded units.

    [ Team LiB ] Previous Section Next Section