Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 32.  The Listbox Widget

Listbox Attributes

Table 32-9 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 32-9. Listbox attribute resource names.
backgroundBackground color (also bg).
borderWidthExtra space around the edge of the text.
cursorCursor to display when mouse is over the widget.
exportSelectionIf true, then the selected text is exported via the X selection mechanism.
fontFont for the text.
foregroundForeground color (also fg).
heightNumber of lines in the listbox.
highlightBackgroundFocus highlight color when widget does not have focus.
highlightColorFocus highlight color when widget has focus.
highlightThicknessThickness of focus highlight rectangle.
reliefflat, sunken, raised, groove, solid, or ridge.
selectBackgroundBackground color of selection.
selectForegroundForeground color of selection.
selectBorderWidthWidth of selection border. Nonzero for 3D effect.
selectModeMode: browse, single, extended, or multiple.
setGridBoolean. Set gridding attribute.
takeFocusControls focus changes from keyboard traversal.
widthWidth, in average character sizes.
xScrollCommandConnects listbox to a horizontal scrollbar.
yScrollCommandConnects 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 grided units.

      Previous section   Next section