scrolledlistbox - Create and manipulate scrolled listbox widgets

SYNOPSIS

scrolledlistbox pathName ?options?

INHERITANCE

itk::Widget <- Labeledwidget <- Scrolledwidget <- Scrolledlistbox

STANDARD OPTIONS

activeBackground
exportSelection
relief
background
foreground
selectBackground
borderWidth
highlightColor
selectBorderWidth
cursor
highlightThickness
selectForeground

See the "options" manual entry for details on the standard options.

ASSOCIATED OPTIONS

selectMode

See the "listbox" widget manual entry for details on the above associated options.

activeRelief
elementBorderwidth
jump
troughColor

See the "scrollbar" widget manual entry for details on the above associated options.

INHERITED OPTIONS

disabledForeground
labelMargin
state
labelBitmap
labelPos
labelFont
labelText
labelImage
labelVariable

See the "labeledwidget" class manual entry for details on the inherited options.

WIDGET-SPECIFIC OPTIONS

Name:                   dblClickCommand
Class:                  Command
Command-Line Switch:	-dblclickcommand

Name:                   height
Class:                  Height
Command-Line Switch:	-height

Name:                   hscrollMode
Class:                  ScrollMode
Command-Line Switch:	-hscrollmode

Name:                   sbWidth
Class:                  Width
Command-Line Switch:	-sbwidth

Name:                   scrollMargin
Class:                  Margin
Command-Line Switch:	-scrollmargin

Name:                   selectionCommand
Class:                  Command
Command-Line Switch:	-selectioncommand

Name:                   state
Class:                  State
Command-Line Switch:	-state

Name:                   textBackground
Class:                  Background
Command-Line Switch -textbackground

Name:                   textFont
Class:                  Font
Command-Line Switch:	-textfont

Name:                   visibleitems
Class:                  VisibleItems
Command-Line Switch:	-visibleitems

Name:                   vscrollMode
Class:                  ScrollMode
Command-Line Switch:	-vscrollmode

Name:                   width
Class:                  Width
Command-Line Switch:	-width

DESCRIPTION

The scrolledlistbox command creates a scrolled listbox with additional options to manage horizontal and vertical scrollbars. This includes options to control which scrollbars are displayed and the method, i.e. statically or dynamically.

METHODS

The scrolledlistbox command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?
Option and the args determine the exact behavior of the command.

Many of the widget commands for a scrolledlistbox take as one argument an indicator of which entry of the list box to operate on. These indicators are called indexes and may be specified in any of the following forms:

number
Specifies the element as a numerical index, where 0 corresponds to the first element in the listbox.
active
Indicates the element that has the location cursor. This element will be displayed with an underline when the listbox has the keyboard focus, and it is specified with the activate widget command.
anchor
Indicates the anchor point for the selection, which is set with the selection anchor widget command.
end
Indicates the end of the listbox. For some commands this means just after the last element; for other commands it means the last element.
@x,y
Indicates the element that covers the point in the listbox window specified by x and y (in pixel coordinates). If no element covers that point, then the closest element to that point is used.
pattern
If the index doesn't satisfy one of the above forms then this form is used. Pattern is pattern-matched against the items in the list box, in order from the top down, until a matching entry is found. The rules of Tcl_StringMatch are used.

The following widget commands are possible for scrolledlistbox widgets:

ASSOCIATED METHODS

activate
get
scan
xview
bbox
index
see
yview
curselection
insert
selection
delete
nearest
size

See the "listbox" manual entry for details on the associated methods.

WIDGET-SPECIFIC METHODS

pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the scrolledlistbox command.
pathName clear
Clears the listbox of all items.
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the scrolledlistbox command.
pathName getcurselection
Returns the contents of the listbox element indicated by the current selection indexes. Short cut version of get and curselection command combination.
pathName justify direction
Justifies the list contents via teh scroll bars in one of four directions: left, right, top, or bottom.
pathName selecteditemcount
Returns the number of items currently selected in the list.
pathName sort order
Sort the current list in either ascending or descending order. The values increasing and decreasing are also accepted.

COMPONENTS

Name:                   listbox
Class:                  listbox

Name:                   horizsb
Class:                  Scrollbar

Name:                   vertsb
Class:                  Scrollbar

EXAMPLE

 option add *textBackground white
 proc selCmd {} {
    puts stdout "[.slb getcurselection]"
 }
 proc defCmd {} {
    puts stdout "Double Click"
    return [selCmd]
 }
 scrolledlistbox .slb -selection single \\
    -vscrollmode static -hscrollmode dynamic -labeltext "List" \\
    -selectioncommand selCmd -dblclickcommand defCmd
 pack .slb -padx 10 -pady 10 -fill both -expand yes
 .slb insert end {Hello {Out There} World} 

AUTHOR

Mark L. Ulferts

KEYWORDS

scrolledlistbox, listbox, widget