The tablelist::tablelist Command

by

Csaba Nemethi

csaba.nemethi@t-online.de


NAME
tablelist::tablelist - Create and manipulate tablelist widgets

SYNOPSIS

tablelist::tablelist pathName ?options?

STANDARD OPTIONS

-borderwidth          -highlightthickness  -setgrid
-cursor               -relief              -xscrollcommand
-exportselection      -selectbackground    -yscrollcommand
-highlightbackground  -selectborderwidth
-highlightcolor       -selectforeground

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

OPTIONS FOR THE BODY COMPONENT OF THE WIDGET

-background  -disabledforeground  -font  -foreground

These options (described in the options manual entry) are only valid for the body component of the tablelist widget.  As discussed in the next section, the colors and font used when drawing the header labels can be different from those specified for the body.

WIDGET-SPECIFIC OPTIONS

Command-Line Name:  -activestyle
Database Name:  activeStyle
Database Class:  ActiveStyle

Specifies how to diplay the active item when the tablelist has the keyboard focus.  The allowed values are frame, none, and underline.  The value frame makes the active item appear surrounded with a thin frame, which looks nice if all of the cells have the same background color, but not so pretty if the background color of some of the cells was changed by using the columnconfigure or cellconfigure widget command.  The value none specifies that no special indication of the active item is to be performed.  The default is underline, which produces the same visual effect as in the case of the core Tk listbox.

Command-Line Name:  -arrowcolor
Database Name:  arrowColor
Database Class:  ArrowColor

Specifies the color to use for the up- or down-arrow placed into a column label by the sortbycolumn subcommand of the Tcl command associated with the widget.  This option is only relevant if the value of the -showarrow option is true.  The default value is an empty string, indicating that the arrow will inherit the background color of the label in which it is placed (but is distinguishable from the latter, due to its 3-D border and sunken relief).

Command-Line Name:  -arrowdisabledcolor
Database Name:  arrowDisabledColor
Database Class:  ArrowDisabledColor

Specifies the color to use for the up- or down-arrow placed into a column label by the sortbycolumn subcommand of the Tcl command associated with the widget when the tablelist's state is disabled.  This option is only relevant if the value of the -showarrow option is true.  The default value is an empty string, indicating that the arrow will inherit the background color of the label in which it is placed (but is distinguishable from the latter, due to its 3-D border and sunken relief).

Command-Line Name:  -columns
Database Name:  columns
Database Class:  Columns

Specifies the widths, titles, and alignments of the columns.  The option's value must be a list of the form

width title ?alignment? width title ?alignment? ...

Each width must be a number.  A positive value specifies the column's width in average-size characters of the widget's font.  If width is negative, its absolute value is interpreted as a column width in pixels.  Finally, a value of zero specifies that the column's width is to be made just large enough to hold all the elements in the column, including its header.  In all three cases, the effective column width will be somewhat greater because of the margins created automatically to the left and right of the column.

Each title specifies the text to be displayed in the column's header, and may optionally be followed in the next list element by an alignment, which specifies how to align the elements of the column.  Each alignment must be one of left, right, or center.  The default is left.  The alignment also refers to the column's title as long as the -labelalign option hasn't been specified for that column, or if its value is an empty string.

The default value of this option is an empty list, specifying that initially the widget has no columns.

Command-Line Name:  -editendcommand
Database Name:  editEndCommand
Database Class:  EditEndCommand

Specifies a Tcl command to be invoked on normal termination of the interactive editing of a cell's contents if the final text of the temporary entry widget used for the editing is different from its initial one.  The command is automatically concatenated with the name of the tablelist widget, the cell's row and column indices, as well as the final contents of the entry, the resulting script is evaluated in the global scope, and the return value becomes the cell's new contents after destroying the temporary entry widget.  The main purpose of this script is to perform a final validation of the entry's contents.  See the INTERACTIVE CELL EDITING section for details on the editing process.

Command-Line Name:  -editstartcommand
Database Name:  editStartCommand
Database Class:  EditStartCommand

Specifies a Tcl command to be invoked when the interactive editing of a cell's contents is started.  The command is automatically concatenated with the name of the tablelist widget, the cell's row and column indices, as well as the text displayed in the cell, the resulting script is evaluated in the global scope, and the return value becomes the initial contents of the temporary entry widget used for the editing.  The main purpose of this script is to define validations for the entry's contents.  See the INTERACTIVE CELL EDITING section for details on the editing process.

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

Specifies the desired height for the window, in lines.  If zero or less then the desired height for the window is made just large enough to hold the header and all the items in the tablelist widget.

Command-Line Name:  -incrarrowtype
Database Name:  incrArrowType
Database Class:  IncrArrowType

Specifies the type of the arrow placed into a column label when invoking the sortbycolumn subcommand of the Tcl command associated with the widget, with -increasing as second argument.  The value of this option must be one of up or down.  The default is up.  This option is only relevant if the value of the -showarrow option is true.

Command-Line Name:  -labelbackground or -labelbg
Database Name:  labelBackground
Database Class:  Background

Specifies the -background option for the header labels.

Command-Line Name:  -labelborderwidth or -labelbd
Database Name:  labelBorderWidth
Database Class:  BorderWidth

Specifies the -borderwidth option for the header labels.  This option is different from the standard -borderwidth option defined for the tablelist widget itself.

Command-Line Name:  -labelcommand
Database Name:  labelCommand
Database Class:  LabelCommand

Specifies the Tcl command to be invoked when mouse button 1 is pressed over one of the header labels and later released over the same label.  When the <ButtonRelease-1> event occurs, the command is automatically concatenated with the name of the tablelist widget and the column index of the respective label, and the resulting script is evaluated in the global scope.  If the tablelist's state is disabled then this action will not take place.  The most common value of this option is tablelist::sortByColumn; this command sorts the items based on the column whose index was passed to it as second argument.

Command-Line Name:  -labeldisabledforeground
Database Name:  labelDisabledForeground
Database Class:  DisabledForeground

Specifies the -disabledforeground option for the header labels, i.e., the foreground color to use for the labels when the tablelist's state is disabled.  This option is only defined if the Tk version being used supports the -state and -disabledforeground options for label widgets.  This is checked by the Tablelist package at initialization time, and will normally be the case for Tk versions 8.3.1 or higher.

Command-Line Name:  -labelfont
Database Name:  labelFont
Database Class:  Font

Specifies the -font option for the header labels.

Command-Line Name:  -labelforeground or -labelfg
Database Name:  labelForeground
Database Class:  Foreground

Specifies the -foreground option for the header labels.

Command-Line Name:  -labelheight
Database Name:  labelHeight
Database Class:  Height

Specifies the -height option for the header labels.

Command-Line Name:  -labelpady
Database Name:  labelPadY
Database Class:  Pad

Specifies the -pady option for the header labels.

Command-Line Name:  -labelrelief
Database Name:  labelRelief
Database Class:  Relief

Specifies the -relief option for the header labels.  This option is different from the standard -relief option defined for the tablelist widget itself.

Command-Line Name:  -listvariable
Database Name:  listVariable
Database Class:  Variable

Specifies the name of a variable.  The value of the variable is a list to be displayed inside the widget; if the variable value changes then the widget will automatically update itself to reflect the new value.  The value of the variable must be a valid list.  Each list element corresponds to a row within the widget, and must be a valid list itself; its elements correspond to the cells within the respective row.  Attempts to assign a variable whose value does not fulfil these conditions to -listvariable will cause an error.  Attempts to unset a variable in use as a -listvariable will fail but will not generate an error.

Command-Line Name:  -movablecolumns
Database Name:  movableColumns
Database Class:  MovableColumns

Specifies a boolean value that determines whether the columns can be moved interactively.  See the DEFAULT BINDINGS FOR THE HEADER LABELS section below for information on moving a column interactively.  The default value is 0.

Command-Line Name:  -movecolumncursor
Database Name:  moveColumnCursor
Database Class:  MoveColumnCursor

Specifies the mouse cursor to be used when moving a column interactively.  The default value is icon.

Command-Line Name:  -resizablecolumns
Database Name:  resizableColumns
Database Class:  ResizableColumns

Specifies a boolean value that determines whether the columns can be resized interactively.  See the DEFAULT BINDINGS FOR THE HEADER LABELS section below for information on interactive column resizing.  The default value is 1.

Command-Line Name:  -resizecursor
Database Name:  resizeCursor
Database Class:  ResizeCursor

Specifies the mouse cursor to be used during interactive column resizing.  The default value is sb_h_double_arrow.

Command-Line Name:  -selectmode
Database Name:  selectMode
Database Class:  SelectMode

Specifies one of several styles for manipulating the selection.  The value of the option may be arbitrary, but the default bindings expect it to be either single, browse, multiple, or extended.  The default value is browse.

Command-Line Name:  -showarrow
Database Name:  showArrow
Database Class:  ShowArrow

Specifies a boolean value that determines whether the sortbycolumn subcommand of the Tcl command associated with the widget should place an arrow indicating the sorting order into the header label of the column specified by its first argument.  The default value is 1.

Command-Line Name:  -showlabels
Database Name:  showLabels
Database Class:  ShowLabels

Specifies a boolean value that determines whether the header labels are to be shown or not.  The default value is 1.

Command-Line Name:  -showseparators
Database Name:  showSeparators
Database Class:  ShowSeparators

Specifies a boolean value that determines whether the columns are to be separated with borders.  The default value is 0.  The separators are implemented as thin frame widgets with raised relief, attached to the right edges of the header labels.  They are only created if the value of this option is true.  There is no support for horizontal separators in tablelist widgets, but a nice distinguishing effect for the rows can be achieved with the aid of the -stripebackground option discussed below.

Command-Line Name:  -snipstring
Database Name:  snipString
Database Class:  SnipString

Specifies the string to be used as snip indicator when displaying the elements that don't fit into their cells.  The default is an ellipsis ("...").

Command-Line Name:  -sortcommand
Database Name:  sortCommand
Database Class:  SortCommand

Specifies a command to be used for the comparison of the items when invoking the sort subcommand of the Tcl command associated with the tablelist widget.  To compare two items (viewed as lists of cell contents within one row each) during the sort operation, the command is automatically concatenated with the two items and the resulting script is evaluated.  The script should return an integer less than, equal to, or greater than zero if the first item is to be considered less than, equal to, or greater than the second, respectively.

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

Specifies one of two states for the tablelist widget: normal or disabled.  If the widget is disabled then items may not be inserted, deleted, or updated, the items, header labels, and the up- or down-arrow are drawn in the -disabledforeground, -labeldisabledforeground, and -arrowdisabledcolor color, respectively, the location of the active item and the selection cannot be modified and are not shown (although the corresponding information is retained), and the header labels are completely insensitive.

Command-Line Name:  -stretch
Database Name:  stretch
Database Class:  Stretch

Specifies the columns to be stretched in order to fill the tablelist window if necessary.  The option's value may be all or a list of column indices in any of the forms described in the COLUMN INDICES section below.  In the second case, the specified column indices are replaced with their numerical equivalents, except for the index end, which is viewed as a dynamic column index whose numerical equivalent might change during program execution and therefore will be recomputed every time the columns are stretched.  The list will be updated automatically whenever columns are inserted, deleted, or moved.  The number of pixels by which a column is stretched is proportional to its width in pixels.  The default value of this option is an empty list, meaning that no column will be stretched to eliminate the blank space that might appear at the right of the table.  (Note that the blank space following the header labels is filled with a dummy, insensitive label having the same background, borderwidth, and relief as the "normal" header labels.)  This option is ignored if the value of the -width configuration option is zero or less.

Command-Line Name:  -stripebackground or -stripebg
Database Name:  stripeBackground
Database Class:  Background

Specifies the background color to use when displaying the items belonging to a stripe.  Each stripe is composed of the same number stripeHeight of consecutive items, according to the value of the -stripeheight configuration option.  The first stripeHeight items are "normal" ones; they are followed by a stripe composed of the next stripeHeight items, which in turn is followed by the same number of "normal" items, and so on.  The default value is an empty string, indicating that the stripes will inherit the background color specified by the -background configuration option.  Compared to the -background option specified at column, row, or cell level, the -stripebackground configuration option has the same low priority as the -background option specified at widget level (see the COLOR AND FONT OPTIONS section for details on these options).

Command-Line Name:  -stripeforeground or -stripefg
Database Name:  stripeForeground
Database Class:  Foreground

Specifies the foreground color to use when displaying the items belonging to a stripe.  The default value is an empty string, indicating that the stripes will inherit the foreground color specified by the -foreground configuration option.  Compared to the -foreground option specified at column, row, or cell level, the -stripeforeground configuration option has the same low priority as the -foreground option specified at widget level (see the COLOR AND FONT OPTIONS section for details on these options).

Command-Line Name:  -stripeheight
Database Name:  stripeHeight
Database Class:  StripeHeight

Specifies the number of items in each stripe.  If zero or less then no stripes are displayed.  The default is 1.

Command-Line Name:  -targetcolor
Database Name:  targetColor
Database Class:  TargetColor

Specifies the color of the temporary gap displayed in the tablelist's header to indicate the target position when moving a column interactively.  The default value is black.

Command-Line Name:  -takefocus
Database Name:  takeFocus
Database Class:  TakeFocus

This option determines whether the widget accepts the focus during keyboard traversal.  It is almost identical to the standard option with the same name (see the options manual entry for details).  The only difference is that not the widget itself but its body child (containing the items) will receive the focus during keyboard traversal with the standard keys (Tab and Shift-Tab).

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

Specifies the desired width for the window, in average-size characters of the widget's font.  If zero or less then the desired width for the window is made just large enough to hold all the columns in the tablelist widget.

DESCRIPTION
The tablelist::tablelist command creates a new window named pathName and of the class Tablelist, and makes it into a tablelist widget.  Additional options, described above, may be specified on the command line or in the option database to configure aspects of the tablelist such as its colors, font, and columns.  The tablelist::tablelist command returns its pathName argument.  At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A tablelist is a multi-column listbox, implemented as a mega-widget, consisting of a body and a header.  The body displays a list of items, one per line.  Each item is a list of elements, which are aligned in columns.  In other words, an item is the contents of a row, and an element is the text contained in a cell.  The header consists of label widgets displaying the column titles.  The labels can be used, among others, for interactive column resizing and column-based sorting of the items, as described below.

Each cell and each header label of a tablelist widget can also contain an image, which is placed to the left or right of the text, depending on the latter's alignment.

The elements of a tablelist widget can, per default, be only edited programmatically.  However, interactive editing can be enabled for individual cells and for entire columns.  The interactive cell editing uses a temporary embedded entry widget, thus making sure that all the validation facilities available for entry widgets can be used during the editing process.  In addition, a rich set of keyboard bindings is provided for a comfortable navigation between the editable cells.

When first created, a new tablelist widget has no items.  Items may be added, deleted, or updated using widget commands described below.  In addition, one or more items may be selected.  If a tablelist widget is exporting its selection (see the -exportselection option), then it will observe the standard X11 protocols for handling the selection.  Tablelist widget selections are available as type STRING; the value of the selection will be a text built by joining all of the non-hidden elements within each selected row together with tabs and the resulting strings in turn with newlines.

It is not necessary for all the elements to be displayed in the tablelist widget at once; commands described below may be used to change the view in the window.  Tablelist widgets allow scrolling in both directions using the standard -xscrollcommand and -yscrollcommand options.  They also support scanning, as described below.

Each tablelist widget may have any number of attributes, which can be used in commands that create or manipulate tablelist widgets for particular purposes.

COLOR AND FONT OPTIONS
The -background, -font, -foreground, -selectbackground, and -selectforeground options can also be specified at column, row, and cell level, by using the columnconfigure, rowconfigure, and cellconfigure subcommands of the Tcl command associated with the tablelist widget.  For this reason, a particular cell can have up to four values for one and the same color or font option.  If these values conflict, then the option specified at the highest priority level is used.  The decreasing priority order is cell, row, column, widget. 

If one of these options hasn't been specified at cell, row, or column level, or if its value for that level is an empty string (this is explicitly allowed), then that option will not be used at that particular level.

ROW INDICES
Many of the widget commands for tablelist widgets take one or more row indices as arguments.  A row index specifies a particular item of the tablelist, in any of the following ways:

number Specifies the item as a numerical index, where 0 corresponds to the first item in the tablelist.
 
knumber Specifies the item by its full key, composed of the letter k and the sequence number associated with the item, as returned by the getkeys widget command.
 
active Indicates the item that has the location cursor.  This item will be displayed according to the value of the -activestyle configuration option when the tablelist 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 tablelist.  For most commands this refers to the last item in the tablelist, but for a few commands such as index, insert, and insertlist, as well as for the target of the move command it refers to the item just after the last one.
 
@x,y Indicates the item that covers the point in the tablelist window specified by x and y (in pixel coordinates).  If no item covers that point, then the closest item to that point is used.

In the widget command descriptions below, arguments named index, first, and last always contain row indices in one of the above forms.

COLUMN INDICES
Some of the widget commands for tablelist widgets take a column index as argument.  A column index specifies a particular column of the tablelist, in any of the following ways:

number Specifies the column as a numerical index, where 0 corresponds to the first column in the tablelist.
 
end Indicates the last column of the tablelist, except for the the commands insertcolumns and insertcolumnlist, as well as for the target of the movecolumn command, in which cases it refers to the column just after the last one.
 
@x,y Indicates the column that covers the point in the tablelist window specified by x and y (in pixel coordinates).  If no column covers that point, then the closest column to that point is used.
 
name Specifies the column by the value of its -name configuration option.  name must be different from all the above column indices, and should be unique (if several columns have the same name then this value is considered to indicate the first matching column).

CELL INDICES
Some of the widget commands for tablelist widgets take a cell index as argument.  A cell index specifies a particular cell of the tablelist, in any of the following ways:

row,col Indicates the cell having the row index row and column index colrow may be a number, a full key (of the form knumber), active, anchor, or end (where the latter indicates the last row in the tablelist).  col may be a number, end, or a column name.
 
end Indicates the last cell in the last row of the tablelist.
 
@x,y Indicates the cell that covers the point in the tablelist window specified by x and y (in pixel coordinates).  If no cell covers that point, then the closest cell to that point is used.

INTERACTIVE CELL EDITING
Whether or not the contents of a cell of a tablelist widget can be edited interactively, depends on the -editable option on both cell and column level.  If the cell-level option was set explicitly then its value determines the editability of the cell's contents.  Otherwise the value of the column-level option is used to decide whether the cell can be edited interactively.  From this rule it follows that you can enable interactive cell editing for a whole column by setting its -editable option to true.  To exclude some of the column's cells from interactive editing, set their -editable option to false.

The interactive cell editing is started by the editcell subcommand, which is invoked implicitly by clicking with the left mouse button into an editable cell or using keyboard navigation to move from one editable cell into another.  This subcommand creates a temporary entry widget and embeds it into the cell whose index was passed to it as argument.

In the simplest case, the text automatically inserted into this entry is the same as the text displayed in the cell, which in turn can be the cell's contents or the string obtained from the latter by using the -formatcommand option of the cell's column.  However, if the value of the -editstartcommand configuration option is a nonempty string, then the text displayed in the cell is passed to that command as its last argument (following the tablelist's path name as well as the cell's row and column indices), the resulting script is evaluated in the global scope, and the return value becomes the entry's contents.  From within this script you can invoke the cancelediting subcommand, which destroys the entry and cancels the interactive editing of its contents.  The main goal of this script is, however, to enable you to define validations for the editing process.  This can be done either with the aid of the options for entry validation, supported in Tk versions 8.3 and higher (see the entry reference page), or by using the widget callback package Wcb, available for Tk versions 8.0 and higher.  In both cases, you will need the path name of the temporary entry, which is returned by the entrypath subcommand.  Finally, one more possible use of the command specified by this option is to change some of the entry's visual attributes (like its background, selection background, or selection foreground color).  Notice that this can also be done with the aid of the Tk option database.

The editing of the text inserted into the temporary entry widget uses the well-known Entry bindings for mouse and keyboard events, with a few extensions and changes, as described in the DEFAULT BINDINGS FOR INTERACTIVE CELL EDITING section.  For example, Control-i inserts a tab, while Control-j, Control-Return, and Control-KP_Enter insert a newline into the entry.  Tab and Shift-Tab are used for navigation between the editable cells, just like Alt-Left, Alt-Right, Up, Down, Prior, Next, Control-Home, and Control-End.  The editing can be aborted with the Escape key (or by invoking the cancelediting subcommand) and terminated normally with Return or KP_Enter (the bindigs for these keys just invoke the finishediting subcommand).  Normal termination is also triggered by clicking with the left mouse button anywhere in the tablelist's body, outside the cell just being edited, or moving into another editable cell by using keyboard navigation.

When normal termination of the editing process occurs, the Tcl command associated with the tablelist widget compares the entry's final contents with its original one.  If they are equal then the entry is destroyed and the cell's original contents is restored.  If the two strings are different and the value of the -editendcommand configuration option is a nonempty string, then the entry's final text is passed to that command as its last argument (following the tablelist's path name as well as the cell's row and column indices), the resulting script is evaluated in the global scope, and the return value becomes the cell's new contents after destroying the temporary entry widget.  The main goal of this script is to enable you to do a final validation of the entry's contents.  From within this script you can invoke the rejectinput subcommand, which prevents the script's return value from becoming the cell's new contents; this subcommand also prevents the destruction of the temporary entry widget.

WIDGET COMMAND
The tablelist::tablelist 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.  The following commands are possible for tablelist widgets:

pathName activate index
Sets the active item to the one indicated by index if the tablelist's state is not disabled.  If index is outside the range of items in the tablelist then the closest item is activated.  The active item is drawn as specified by the -activestyle configuration option) when the widget has the input focus, and its index may be retrieved with the index active.  Returns an empty string.

pathName attrib ?name? ?value name value ...?
Queries or modifies the attributes of the widget.  If no name is specified, the command returns a list of pairs, each of which contains the name and the value of an attribute for pathName.  If name is specified with no value, then the command returns the value of the one named attribute.  If one or more name-value pairs are specified, then the command sets the given widget attribute(s) to the given value(s); in this case the return value is an empty string.  name may be an arbitrary string.

pathName bbox index
Returns a list of four numbers describing the bounding box of the row given by index.  The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the row (specified in pixels relative to the widget) and the last two elements give the width and height of the area, in pixels.  If no part of the row given by index is visible on the screen, or if index refers to a non-existent row, then the result is an empty string; if the row is partially visible, the result gives the full area of the row, including any parts that are not visible.

pathName bodypath
Returns the path name of the body component of the widget.

pathName cancelediting
This subcommand cancels the interactive editing of the contents of the cell whose index was passed to the editcell subcommand, destroys the temporary entry widget embedded into the cell, and restores the original cell contents.  This command enables you to cancel the interactive cell editing from within the Tcl command specified by the -editstartcommand configuration option if that pre-edit callback encounters an error when preparing the text to be inserted into the temporary entry widget.  The command is also invoked implicitly by pressing the Escape key when a cell is being edited.  The return value is an empty string, which is also returned if no cell was being edited when the command was invoked.

pathName cellcget cellIndex option
Returns the current value of the cell configuration option given by option for the cell specified by cellIndexoption may have any of the values accepted by the cellconfigure command.

pathName cellconfigure cellIndex ?option? ?value option value ...?
Queries or modifies the configuration options of the cell given by cellIndex.  If no option is specified, the command returns a list describing all of the available options for the cell (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 cell option(s) to have the given value(s); in this case the return value is an empty string.  The following options are currently supported for cells:

-background color or -bg color
Specifies the normal background color to use when displaying the contents of the cell.

-editable boolean
Specifies whether the contents of the cell can be edited interactively.  The default value is 0.  This option overrides the one with the same name for the column containing the given cell.

-font font
Specifies the font to use when displaying the contents of the cell.

-foreground color or -fg color
Specifies the normal foreground color to use when displaying the contents of the cell.

-image image
Specifies the name of the Tk image to be displayed in the cell.  image must be the result of an invocation of the  image create  command, or an empty string, specifying that no image is to be displayed.  If the column containing the cell is right-aligned then the image will be displayed to the right of the cell's text, otherwise to its left.  The text and the image are separated from each other by a space character.  If the tablelist's state is disabled then this option will be ignored.

-selectbackground color
Specifies the background color to use when displaying the contents of the cell while its row is selected.

-selectforeground color
Specifies the foreground color to use when displaying the contents of the cell while its row is selected.

-text text
Specifies the string to be displayed in the given cell, i.e., updates the element contained in the cell.  If the tablelist's state is disabled then this option will be ignored.

The -background, -font, -foreground, -selectbackground, and -selectforeground cell configuration options override the options with the same names set at row, column, or widget level if the specified value is not an empty string.  See the COLOR AND FONT OPTIONS section for further details on these options.

pathName cellindex cellIndex
Returns the canonical cell index value that corresponds to cellIndex, in the form row,col, where row and col are integers.

pathName cget option
Returns the current value of the configuration option given by option, which may have any of the values accepted by the tablelist::tablelist command.

pathName columncget columnIndex option
Returns the current value of the column configuration option given by option for the column specified by columnIndexoption may have any of the values accepted by the columnconfigure command.

pathName columnconfigure columnIndex ?option? ?value option value ...?
Queries or modifies the configuration options of the column given by columnIndex.  If no option is specified, the command returns a list describing all of the available options for the column (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 column option(s) to have the given value(s); in this case the return value is an empty string.  The following options are currently supported for columns:

-align alignment
Specifies how to align the elements of the column.  It must be one of left, right, or center.  This option also refers to the column's title if the -labelalign option hasn't been specified for the given column, or if its value is an empty string.  The -align option is tied to the alignment element corresponding to this column in the list specifying the value of the -columns option for the tablelist widget; changes in either will automatically be reflected in the other.

-background color or -bg color
Specifies the normal background color to use when displaying the contents of the column.

-editable boolean
Specifies whether the elements of the column can be edited interactively.  The default value is 0.  The value of this option can be overridden for individual cells by using the cell configuration option with the same name.

-font font
Specifies the font to use when displaying the contents of the column.

-foreground color or -fg color
Specifies the normal foreground color to use when displaying the contents of the column.

-formatcommand command
Specifies the Tcl command to be invoked when displaying the contents of a cell within this column or adding it to the selection when the latter is being exported.  If command is a nonempty string, then it is automatically concatenated with the cell's text, the resulting script is evaluated in the global scope, and the return value is displayed in the cell or added to the selection instead of the original data.  For example, if a time value in seconds is being inserted into the cell and command is the procedure formatDate defined as

proc formatDate clockVal { return [clock format $clockVal -format %Y-%m-%d] }

then the text displayed in the cell will be the date in the specified format, not the time value in seconds.  Notice that this option is only used for preparing the text to be displayed or returned when exporting the selection, and does not affect the internal cell contents.  For example, the get, getcolumns, rowcget, cellcget, sort, and sortbycolumn subcommands all operate on the original cell text, which is contained in the widget's internal list.  In the case of the above example, this will make it possible to sort the items very easily by time, with a second's precision, even if their visual representation only contains the year, month, and day.

-hide boolean
Specifies whether to hide the column when displaying the widget or exporting its selection.  The default value is 0.

-labelalign alignment
Specifies how to align the column's title.  It must be one of left, right, or center, or an empty string.  If this option hasn't been specified for the given column, or if its value is an empty string, then the header title will have the same alignment as the elements of the column, as given by the -align column configuration option or by the alignment element corresponding to this column in the list specifying the value of the -columns global option.

-labelbackground color or -labelbg color
-labelborderwidth pixels or -labelbd pixels
-labelcommand command
-labelfont fontName
-labelforeground color or -labelfg color
-labelheight lines
-labelpady pixels
-labelrelief relief
The value of each of these options may also be an empty string.  These options are the column-specific equivalents of the global ones having the same names, described in the WIDGET-SPECIFIC OPTIONS section.  They override the options with the same names set at widget level if the specified value is not empty.  If one of these options hasn't been specified for the given column, or if its value is an empty string, then that option will not be used at column level; the global option with the same name will be used instead.  The -labeldisabledforeground option is only defined at widget level; there is no column configuration option with this name.

-labelimage image
Specifies the name of the Tk image to be displayed in the header label.  image must be the result of an invocation of the  image create  command, or an empty string, specifying that no image is to be displayed.  If the label's text is right-aligned then the image will be displayed to the right of the text, otherwise to its left.  The text and the image are separated from each other by a gap corresponding to the width of a space character in the given column's font in the body (!) of the tablelist widget.

-name name
Specifies a name associated with the column.  While the numerical index of a column might change by inserting, deleting, or moving columns, its name remains constant and can be used as a safe alternative column index (see the COLUMN INDICES section for details).  Similarly, it can also be used as the second component of a cell index of the form row,col, as described in the CELL INDICES section.  To avoid confusions, column names should be different from any other forms of column indices (like numbers, end, or any abbreviations of the latter).  They should also be different from (any abbreviations of) the string all, which may be specified as the value of the -stretch configuration option.  The default value is an empty string.

-resizable boolean
Specifies whether the column can be resized interactively.  See the DEFAULT BINDINGS FOR THE HEADER LABELS section for information on interactive column resizing.  The default value is 1.  This option is only relevant if the value of the -resizablecolumns widget configuration option is true.

-selectbackground color
Specifies the background color to use when displaying the contents of a cell in the given column while the cell's row is selected.

-selectforeground color
Specifies the foreground color to use when displaying the contents of a cell in the given column while the cell's row is selected.

-showarrow boolean
Specifies whether the sortbycolumn command with the given column index as first argument should place an arrow indicating the sorting order into the column's label.  The default value is 1.  This option is only relevant if the value of the -showarrow widget configuration option is true.

-sortcommand command
This option is only relevant if the value of the -sortmode option for the given column is command.  It specifies a command to be used for the comparison of the column's elements when invoking the sortbycolumn command with the given column index as first argument.  To compare two elements during the sortbycolumn operation, command is automatically concatenated with the two elements and the resulting script is evaluated.  The script should return an integer less than, equal to, or greater than zero if the first element is to be considered less than, equal to, or greater than the second, respectively.

-sortmode mode
Specifies how to compare the column's elements when invoking the sortbycolumn command with the given column index as first argument.  mode may have any of the following values:

ascii Use string comparison with ASCII collation order.  This is the default.
 
command Use the command specified by the -sortcommand column configuration option to compare the column's elements.
 
dictionary Use dictionary-style comparison.  This is the same as ascii, except: (a) case is ignored except as a tie-breaker; (b) if two strings contain embedded numbers, the numbers compare as integers, not characters.  For example, bigBoy sorts between bigbang and bigboy, and x10y sorts between x9y and x11y.
 
integer Convert the elements to integers and use integer comparison.
 
real Convert the elements to floating-point values and use floating-point comparison.

-text list
Specifies a list of strings to be displayed in the cells of the given column, i.e., updates the elements contained in the column.  If the tablelist's state is disabled then this option will be ignored.

-title title
Specifies the text to be displayed in the column's header.  This option is tied to the title element corresponding to the given column in the list specifying the value of the -columns option for the tablelist widget; changes in either will automatically be reflected in the other.

-width width
width must be a number.  A positive value specifies the column's width in average-size characters of the widget's font.  If width is negative, its absolute value is interpreted as a column width in pixels.  Finally, a value of zero specifies that the column's width is to be made just large enough to hold all the elements in the column, including its header.  This option is tied to the width element corresponding to the given column in the list specifying the value of the -columns option for the tablelist widget; changes in either will automatically be reflected in the other.

The -background, -font, -foreground, -selectbackground, and -selectforeground column configuration options override the options with the same names set at widget level (but not the ones set at cell or row level) if the specified value is not an empty string.  See the COLOR AND FONT OPTIONS section for further details on these options.

pathName columncount
Returns the number of columns in the tablelist widget.

pathName columnindex columnIndex
Returns the integer column index value that corresponds to columnIndex.

pathName configure ?option? ?value option value ...?
Queries or modifies the configuration options of the widget.  If no option is specified, the command 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 return value is an empty string.  option may have any of the values accepted by the tablelist::tablelist command.

pathName containing y
Given a y-coordinate within the tablelist window, this command returns the index of the tablelist item containing that y-coordinate.  If no corresponding item is found then the return value is -1.

pathName containingcell x y
Given an x- and a y-coordinate within the tablelist window, this command returns the index of the tablelist cell containing the point having these coordinates.  If no corresponding cell is found then the row or column component (or both) of the return value is -1.

pathName containingcolumn x
Given an x-coordinate within the tablelist window, this command returns the index of the tablelist column containing that x-coordinate.  If no corresponding column is found then the return value is -1.

pathName curselection
Returns a list containing the numerical indices of all of the items in the tablelist that are currently selected.  If there are no items selected in the tablelist then an empty string is returned.

pathName delete first last
pathName delete indexList
Deletes one or more items of the tablelist if its state is not disabled.  In the first form of the command, first and last are indices specifying the first and last items in the range to delete.  The command's second form accepts a list indexList of indices specifying the items to be deleted.  Returns an empty string.

pathName deletecolumns firstColumn lastColumn
pathName deletecolumns columnIndexList
Deletes one or more columns of the tablelist if its state is not disabled.  In the first form of the command, firstColumn and lastColumn are indices specifying the first and last columns in the range to delete.  The command's second form accepts a list columnIndexList of indices specifying the columns to be deleted.  Returns an empty string.

pathName editcell cellIndex
Starts the interactive editing of the cell's contents if the tablelist's state is not disabled, the cell's column is not hidden, and the cell is editable.  Returns an empty string.  See the INTERACTIVE CELL EDITING section for details on editablity and on the editing process.

pathName entrypath
Returns the path name of the temporary embedded entry widget used for interactive cell editing, created by the editcell subcommand.  If no cell is currently being edited then the return value is an empty string.  This subcommand enables you to access the temporary entry widget from within the commands specified by the -editstartcommand and -editendcommand configuration options.

pathName fillcolumn columnIndex text
Sets all the elements of the specified column to the value text.

pathName finishediting
This subcommand attempts to terminate the interactive editing of the contents of the cell whose index was passed to the editcell subcommand by destroying the temporary entry widget embedded into the cell and updating the cell's contents.  The exact steps involved are as follows:  First, the entry's final contents is compared with its original one.  If they are equal then the entry is destroyed and the cell's original contents is restored.  If the two strings are different and the value of the -editendcommand configuration option is a nonempty string, then the entry's final text is passed to that command as its last argument (following the tablelist's path name as well as the cell's row and column indices), the resulting script is evaluated in the global scope, and the return value becomes the cell's new contents after destroying the temporary entry widget.  However, if from within this script the rejectinput subcommand was invoked then the cell's contents is not changed and the entry remains displayed in the cell; in this case the command returns the boolean value 0.  In all the other cases, the return value is 1; the latter is also returned if no cell was being edited when the command was invoked.  This subcommand is called implicitly by pressing Return or KP_Enter when editing a cell, or by clicking with the left mouse button anywhere in the tablelist's body, outside the cell just being edited, or moving into another editable cell by using keyboard navigation.

pathName get first last
pathName get indexList
The first form of the command returns a list whose elements are all of the tablelist items between first and last, inclusive.  The value returned by the second form depends on the number of elements in the list indexList: if the latter contains exactly one index then the return value is the tablelist item indicated by that index (or an empty string if the index refers to a non-existent item); otherwise the command returns the list of all of the tablelist items corresponding to the indices specified by indexList.

pathName getcolumns firstColumn lastColumn
pathName getcolumns columnIndexList
The first form of the command returns a list whose elements are lists themselves, where each of the sublists corresponds to exactly one column between firstColumn and lastColumn, inclusive, and consists of all of the tablelist elements contained in that column.  The value returned by the second form depends on the number of elements in the list columnIndexList: if the latter contains exactly one column index then the return value is a list consisting of all of the tablelist elements contained in the column indicated by that column index; otherwise the command returns a list whose elements are lists themselves, where each of the sublists corresponds to exactly one column index in columnIndexList and consists of all of the tablelist elements contained in that column.

pathName getkeys first last
pathName getkeys indexList
The first form of the command returns a list whose elements are all of the sequence numbers associated with the tablelist items between first and last, inclusive.  The value returned by the second form depends on the number of elements in the list indexList: if the latter contains exactly one index then the return value is the sequence number associated with the tablelist item indicated by that index (or an empty string if the index refers to a non-existent item); otherwise the command returns the list of all of the sequence numbers associated with the tablelist items corresponding to the indices specified by indexList.  Each item of a tablelist widget has a unique sequence number that remains unchanged until the item is deleted, thus acting as a key that uniquely identifies the item even if the latter's position (i.e., row index) changes.  This command provides read-only access to these internal item IDs.

pathName index index
Returns the integer row index value that corresponds to index.  If index is end then the return value is the number of items in the tablelist (not the index of the last item).

pathName insert index ?item item ...?
Inserts zero or more new items in the widget's internal list just before the item given by index if the tablelist's state is not disabled.  If index equals the number of items or is specified as end then the new items are added to the end of the widget's list.  Tabulator and newline characters are displayed as \t and \n (i.e., a backslash followed by a t and n, respectively), but are inserted unchanged into the internal list.  The return value is an empty string.

pathName insertcolumnlist columnIndex columnList
Inserts the columns specified by the list columnList just before the column given by columnIndex if the tablelist's state is not disabled.  If columnIndex equals the number of columns or is specified as end then the new columns are added to the end of the column list.  The argument columnList must be a list containing the width, title, and optional alignment specifications for the new columns, in the same form as in the case of the -columns configuration option.  The return value is an empty string.  The elements of the new columns are initially empty strings; the easiest way to change these values is to use the fillcolumn subcommand or the -text column configuration option.  This command has the same effect as

eval [list $pathName insertcolumns $columnIndex] $columnList

but it is more efficient and easier to use.

pathName insertcolumns columnIndex ?width title ?alignment? width title ?alignment? ...?
Inserts zero or more new columns just before the column given by columnIndex if the tablelist's state is not disabled.  If columnIndex equals the number of columns or is specified as end then the new columns are added to the end of the column list.  The arguments following the column index have the same meanings as in the case of the -columns configuration option.  The return value is an empty string.  The elements of the new columns are initially empty strings; the easiest way to change these values is to use the fillcolumn subcommand or the -text column configuration option.

pathName insertlist index itemList
Inserts the items of the list itemList in the widget's internal list just before the item given by index if the tablelist's state is not disabled.  If index equals the number of items or is specified as end then the new items are added to the end of the widget's list.  Tabulator and newline characters are displayed as \t and \n (i.e., a backslash followed by a t and n, respectively), but are inserted unchanged into the internal list.  The return value is an empty string.  This command has the same effect as

eval [list $pathName insert $index] $itemList

but it is more efficient and easier to use.

pathName labelpath columnIndex
Returns the path name of the header label corresponding to the column indicated by columnIndex.

pathName labels
Returns a list containing the path names of all header labels of the widget.

pathName move source target
Moves the item indicated by source just before the one given by target if the tablelist's state is not disabled.  If target equals the nunber of items or is specified as end then the source item is moved after the last one.  Returns an empty string.

pathName movecolumn sourceColumn targetColumn
Moves the column indicated by sourceColumn just before the one given by targetColumn if the tablelist's state is not disabled.  If targetColumn equals the number of columns or is specified as end then the source column is moved after the last one.  Returns an empty string.

pathName nearest y
Given a y-coordinate within the tablelist window, this command returns the index of the (non-hidden) tablelist item nearest to that y-coordinate.

pathName nearestcell x y
Given an x- and a y-coordinate within the tablelist window, this command returns the index of the (non-hidden) tablelist cell nearest to the point having these coordinates.

pathName nearestcolumn x
Given an x-coordinate within the tablelist window, this command returns the index of the (non-hidden) tablelist column nearest to that x-coordinate.

pathName rejectinput
If invoked from within the Tcl command specified by the -editendcommand configuration option, then this subcommand prevents the termination of the interactive editing of the contents of the cell whose index was passed to the editcell subcommand.  It invokes the seecell subcommand to make sure the respective cell becomes visible (in case it was scrolled out of view), and sets the focus to the temporary entry widget embedded into the cell.  This command enables you to reject the entry's text during the final validation of the string intended to become the new cell contents.

pathName resetsortinfo
Resets the information about the sorting of the items.  Subsequent invocations of sortcolumn and sortorder will return -1 and an empty string, respectively.  This command also removes an existing up- or down-arrow displayed in any of the header labels by an earlier invocation of sortbycolumn.  The return value is an empty string.

pathName rowcget index option
Returns the current value of the row configuration option given by option for the row specified by indexoption may have any of the values accepted by the rowconfigure command.

pathName rowconfigure index ?option? ?value option value ...?
Queries or modifies the configuration options of the row given by index.  If no option is specified, the command returns a list describing all of the available options for the row (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 row option(s) to have the given value(s); in this case the return value is an empty string.  The following options are currently supported for rows:

-background color or -bg color
Specifies the normal background color to use when displaying the contents of the row.

-font font
Specifies the font to use when displaying the contents of the row.

-foreground color or -fg color
Specifies the normal foreground color to use when displaying the contents of the row.

-selectable boolean
Specifies whether the item displayed in the given row can be selected.  The default value is 1.  If the value 0 was given then any attempt to select the item contained in this row with the aid of the  selection set  widget command will be silently ignored; moreover, an existing old selection is removed from the row.

-selectbackground color
Specifies the background color to use when displaying the contents of the row while it is selected.

-selectforeground color
Specifies the foreground color to use when displaying the contents of the row while it is selected.

-text list
Specifies a list of strings to be displayed in the cells of the given row, i.e., updates the item contained in the row.  If the tablelist's state is disabled then this option will be ignored.

The -background, -font, -foreground, -selectbackground, and -selectforeground row configuration options override the options with the same names set at column or widget level (but not the ones set at cell level) if the specified value is not an empty string.  See the COLOR AND FONT OPTIONS section for further details on these options.

pathName scan option args
This command is used to implement scanning on tablelist widgets.  It has two forms, depending on option:

pathName scan mark x y
Records x and y and the current view in the tablelist window; used in conjunction with later  scan dragto  commands.  Typically this command is associated with a mouse button press in the body component of the widget.  It returns an empty string.

pathName scan dragto x y
This command computes the difference between its x and y arguments to the last  scan mark  command for the widget.  It then adjusts the view (the vertical one only in the body component) by 10 times the difference in coordinates.  This command is typically associated with mouse motion events in the body component of the widget, to produce the effect of dragging the table at high speed through the window.  The return value is an empty string.

pathName see index
Adjusts the view in the tablelist so that the item given by index is visible.  If the item is already visible then the command has no effect; if the item is near one edge of the window then the tablelist scrolls to bring the item into view at the edge; otherwise the tablelist scrolls to center the item.

pathName seecell cellIndex
Adjusts the view in the tablelist so that the cell given by cellIndex is visible.  If the cell is already visible then the command has no effect; if the cell is near one edge of the window then the tablelist scrolls to bring the cell into view at the edge; otherwise the tablelist scrolls to center the cell.

pathName seecolumn columnIndex
Adjusts the view in the tablelist so that the column given by columnIndex is visible.  If the column is already visible then the command has no effect; if the column is near one edge of the window then the tablelist scrolls to bring the column into view at the edge; otherwise the tablelist scrolls to center the column.

pathName selection option args
This command is used to adjust the selection within a tablelist widget.  It has several forms, depending on option:

pathName selection anchor index
Sets the selection anchor to the item given by index.  If index refers to a nonexistent item then the closest item is used.  The selection anchor is the end of the selection that is fixed while dragging out a selection with the mouse.  The index anchor may be used to refer to the anchor item.

pathName selection clear first last
pathName selection clear indexList
If any of the items between first and last (inclusive) or corresponding to the indices specified by the list indexList are selected, they are deselected.  The selection state is not changed for items outside the range given in the first form of the command or different from those specified by the index list given in its second form.

pathName selection includes index
Returns 1 if the item indicated by index is currently selected, 0 if it isn't.

pathName selection set first last
pathName selection set indexList
Selects all of the selectable items in the range between first and last, inclusive, or corresponding to the indices specified by the list indexList, without affecting the selection state of any other items.

If the tablelist's state is disabled and option is different from includes then the command just returns an empty string, without performing any of the above actions.

pathName separatorpath columnIndex
Returns the path name of the separator frame attached to the right edge of the header label indicated by columnIndex.  If the value of the -showseparators configuration option is false then the return value is an empty string.

pathName separators
Returns a list containing the path names of all column separators.  If the value of the -showseparators configuration option is false then the return value is an empty string.

pathName size
Returns the total number of items in the tablelist widget.

pathName sort ?-increasing|-decreasing?
Sorts the items in increasing or decreasing order, as specified by the optional argument.  The default is -increasing.  Uses the value of the -sortcommand widget configuration option as comparison command.  sort also removes an existing up- or down-arrow displayed in any of the header labels by an earlier invocation of the sortbycolumn command.

pathName sortbycolumn columnIndex ?-increasing|-decreasing?
Sorts the items based on the elements of the column given by columnIndex, in increasing or decreasing order, as specified by the optional argument.  The default is -increasing.  The sorting process is controlled by the values of the -sortmode and -sortcommand options for the given column.  If both the value of the -showarrow configuration option and that of the -showarrow option for the specified column are true then an up- or down-arrow indicating the sorting order will be placed into the column's label.  The shape of the arrow depends on the command's optional argument and on the value of the -incrarrowtype configuration option.  If the label's contents is right-aligned then the arrow will be displayed on the left side of the label, otherwise on its right side.

pathName sortcolumn
Returns the numerical index of the column by which the items were last sorted with the aid of the sortbycolumn command, or -1 if they were last sorted with the sort command or haven't been sorted at all, or the sorting information was reset by invoking resetsortinfo.

pathName sortorder
Returns the sorting order (as increasing or decreasing) from the last invocation of the sort or sortbycolumn command, or an empty string if the items haven't been sorted at all, or the sorting information was reset by invoking resetsortinfo.

pathName xview args
This command is used to query and change the horizontal position of the information in the widget's window.  It can take any of the following forms:

pathName xview
Returns a list containing two elements.  Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window.  For example, if the first element is .2 and the second element is .6, 20% of the tablelist's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right.  These are the same values passed to scrollbars via the -xscrollcommand option.

pathName xview units
Adjusts the view in the window so that the character position given by units is displayed at the left edge of the window.  Character positions are defined by the width of the character 0.

pathName xview moveto fraction
Adjusts the view in the window so that fraction of the total width of the tablelist text is off-screen to the left.  fraction must be a fraction between 0 and 1.

pathName xview scroll number what
This command shifts the view in the window left or right according to number and whatnumber must be an integer.  what must be either units or pages or an abbreviation of one of these.  If what is units, the view adjusts left or right by number character units (the width of the 0 character) on the display; if it is pages then the view adjusts by number screenfuls.  If number is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible.

pathName yview args
This command is used to query and change the vertical position of the text in the window of the widget's body component.  It can take any of the following forms:

pathName yview
Returns a list containing two elements, both of which are real fractions between 0 and 1.  The first element gives the position of the tablelist item at the top of the window, relative to the tablelist as a whole (0.5 means it is halfway through the tablelist, for example).  The second element gives the position of the tablelist item just after the last one in the window, relative to the tablelist as a whole.  These are the same values passed to scrollbars via the -yscrollcommand option.

pathName yview index
Adjusts the view in the window so that the item given by index is displayed at the top of the window.

pathName yview moveto fraction
Adjusts the view in the window so that the item given by fraction appears at the top of the window.  fraction is a fraction between 0 and 1; 0 indicates the first item in the tablelist, 0.33 indicates the item one-third the way through the tablelist, and so on.

pathName yview scroll number what
This command shifts the view in the window up or down according to number and whatnumber must be an integer.  what must be either units or pages or an abbreviation of one of these.  If what is units, the view adjusts up or down by number lines; if it is pages then the view adjusts by number screenfuls.  If number is negative then earlier items become visible; if it is positive then later items become visible.

DEFAULT BINDINGS FOR THE TABLELIST BODY
The body component of a tablelist is implemented as a text widget whose binding tag Text is replaced with a new binding tag called TablelistBody.  The latter has the same events as the Listbox widget class, and its binding scripts are obtained from those of Listbox by replacing the event fields %W, %x, and %y with the values of the variables tablelist::W, tablelist::x, and tablelist::y, defined as follows:

set tablelist::W [winfo parent %W] set tablelist::x [expr {%x + [winfo x %W]}] set tablelist::y [expr {%y + [winfo y %W]}]

These bindings, created automatically by the tablelist::tablelist command, ensure that the body component of a tablelist has the same behavior as a listbox widget.  Everything described in the "DEFAULT BINDINGS" section of the listbox manual entry applies to the body component of a tablelist, too.  The only difference is that the word "element" in that manual page has to be replaced with "item" when applying the description to the body of a tablelist widget.

The coordinate transformations shown above are necessary because the Tcl command associated with a tablelist expects any coordinates relative to the widget itself, not its body component.  They use help variables from the tablelist namespace in order to avoid any conflicts with global variables.  The same transformations are needed when defining new bindings for individual tablelist widgets, like in the following example, in which the binding script associated with the <Button-1> event in the body component of the tablelist widget .tbl prints the index of the cell where mouse button 1 was clicked:

bind [.tbl bodypath] <Button-1> {
    set tablelist::x [expr {%x + [winfo x %W]}]
    set tablelist::y [expr {%y + [winfo y %W]}]
    puts "clicked on cell [.tbl nearestcell $tablelist::x $tablelist::y]"
}

DEFAULT BINDINGS FOR THE COLUMN SEPARATORS
The binding tag TablelistBody replaces the binding tag Frame of the separator widgets, too.  This makes sure that the default handling of the mouse events on the column separators is the same as inside the cells.  It is recommended to keep this identical event handling also when defining non-default binding scripts.  To achieve this goal, the example above could be modified as follows:

set widgets [.tbl separators] lappend widgets [.tbl bodypath] foreach w $widgets { bind $w <Button-1> { set tablelist::x [expr {%x + [winfo x %W]}] set tablelist::y [expr {%y + [winfo y %W]}] puts "clicked on cell [.tbl nearestcell $tablelist::x $tablelist::y]" } }

This change is, of course, only needed if the -showseparators option was set to true.

DEFAULT BINDINGS FOR THE HEADER LABELS
The tablelist::tablelist command automatically creates the following bindings for the header labels:

  1. If the mouse pointer is on the right edge of a header label or inside the label but within a few pixels of its right border, and both the value of the -resizablecolumns configuration option and that of the -resizable option for the column corresponding to that label are true, then the mouse cursor takes on the shape specified by the -resizecursor option.  By clicking mouse button 1 in this area of the label and moving the mouse while its button 1 is down, the column corresponding to that label will be resized by the amount of the cursor motion. The interactive column resizing ends when mouse button 1 is released, and can be canceled by pressing the Escape key.  In both cases, the mouse cursor is reset to its original value, specified by the -cursor configuration option.

  2. If mouse button 1 is pressed over a header label but outside the right border area described above and then dragged outside the label, and the value of the -movablecolumns configuration option is true, then the mouse cursor takes on the shape specified by the -movecolumncursor option, indicating that the column in question is being moved to another position, visualized with the aid of a gap placed before the label of the target column.  This operation ends when mouse button 1 is released, and can be canceled by pressing the Escape key when the mouse pointer is outside the label.  In both cases, the mouse cursor is reset to its original value, specified by the -cursor configuration option.  After releasing mouse button 1, the source column is moved before the one indicated by the gap mentioned above.

  3. If mouse button 1 is pressed over a header label but outside the right border area described above and later released over the same label, and the command specified by the -labelcommand option is a nonempty string, then this command is concatenated with the name of the tablelist widget and the column index of the respective label, and the resulting script is evaluated in the global scope.  If another nonempty label command was specified at column level by using the columnconfigure option of the Tcl command associated with the tablelist widget, then that column-specific command will be used instead of the global one.

  4. The Tablelist package defines the virtual event <<Button3>> as <Button-3> for all windowing systems and additionally as <Control-Button-1> for Mac OS Classic and Mac OS X Aqua.  If this event occurs over a header label and both the value of the -resizablecolumns configuration option and that of the -resizable option for the column corresponding to that label are true, then the width of that column is set to zero, i.e., it is made just large enough to hold all the elements in the column, including the header.

If the tablelist's state is disabled then none of the above actions occur: the labels are completely insensitive.

DEFAULT BINDINGS FOR INTERACTIVE CELL EDITING
The tablelist::tablelist command extends and partially redefines the bindings of the temporary embedded entry widget used for interactive cell editing, which is started by clicking mouse button 1 in an editable cell or using keyboard navigation to move from one editable cell into another, as described below:

  1. Control-i inserts a tabulator character into the entry, at the point of the insertion cursor.

  2. Control-j, Control-Return, and Control-KP_Enter insert a newline character into the entry, at the point of the insertion cursor.

  3. Escape aborts the editing and destroys the embedded entry widget.

  4. Return and KP_Enter terminate the editing and destroy the embedded entry widget.

  5. A click with the left mouse button anywhere in the tablelist's body, outside the cell just being edited, terminates the editing in the current cell and destroys the embedded entry widget or moves it into the cell that was just clicked into if the latter is editable.

  6. When editing a cell that is not the only editable cell of the tablelist widget, Tab and Shift-Tab terminate the editing in the current cell, move the entry widget into the next/previous editable cell of the tablelist, select the entry's contents, and set the insertion cursor to its end.  Notice that these bindings replace the common inter-widget navigation via Tab and Shift-Tab with inter-cell navigation.  Just like in the case of the text widget, Control-Tab and Control-Shift-Tab are intended to be used for widget-to-widget keyboard navigation during interactive cell editing.  Unfortunately, some window managers intercept the latter key sequences and use them for their own purposes (like inter-workplace navigation).  For this reason, Tablelist supports the additional key sequences Meta-Tab and Meta-Shift-Tab as replacements for Control-Tab and Control-Shift-Tab, respectively.

  7. When editing a cell that is not the first/last editable cell within its row, Alt-Left/Alt-Right terminates the editing in the current cell, moves the entry widget into the previous/next editable cell of the row, selects the entry's contents, and sets the insertion cursor to its end.  If there is no editable cell to the left/right of the current one then Alt-Left/Alt-Right moves the insertion cursor to the beginning/end of the entry and clears the selection in it.  The key sequence Meta-Left/Meta-Right has the same effect as Alt-Left/Alt-Right.  If tk_strictMotif is false then Meta-b and Meta-f behave the same as Alt-Left and Alt-Right, respectively.

  8. When editing a cell that is not the first/last editable cell within its column, the Up/Down key terminates the editing in the current cell, moves the entry widget one line up/down within the column, selects the entry's contents, and sets the insertion cursor to its end.  If tk_strictMotif is false then Control-p and Control-n behave the same as Up and Down, respectively.

  9. When editing a cell that is not the first/last editable cell within its column, the Prior/Next key terminates the editing in the current cell, moves the entry widget up/down by one page within the column, selects the entry's contents, and sets the insertion cursor to its end.

  10. When editing a cell that is not the only editable cell of the tablelist widget, Control-Home/Control-End terminates the editing in the current cell, moves the entry widget into the first/last editable cell of the tablelist, selects the entry's contents, and sets the insertion cursor to its end.  If tk_strictMotif is false then Meta-< and Meta-> behave the same as Control-Home and Control-End, respectively.

If the tablelist's state is disabled then none of the above actions occur.

KEYWORDS
tablelist, multi-column, listbox, widget

Start page