|
|
 |
ActiveTcl 8.5 documentation
|
ActiveTcl User Guide |
|
Contents
Quick Reference
- 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
- OPTIONS FOR THE BODY COMPONENT OF THE
WIDGET
-
-background -disabledforeground -font -foreground
- WIDGET-SPECIFIC OPTIONS
-activestyle
frame|none|underline
-arrowcolor
color
-arrowstyle
flat7x4|flat7x5|flat7x7|flat8x5|flat9x5|
sunken8x7|sunken10x9|sunken12x11
-arrowdisabledcolor
color
-columns {width
title ?left|right|center? width
title ?left|right|center?
...}
-editendcommand
command
-editstartcommand
command
-forceeditendcommand
boolean
-height
lines
-incrarrowtype
up|down
-labelactivebackground
color
-labelactiveforeground
color
-labelbackground
color or -labelbg
color
-labelborderwidth
screenDistance or -labelbd
screenDistance
-labelcommand
command
-labelcommand2
command
-labeldisabledforeground
color
-labelfont
font
-labelforeground
color or -labelfg
color
-labelheight
lines
-labelpady
screenDistance
-labelrelief
raised|sunken|flat|ridge|solid|
groove
-listvariable
variable
-movablecolumns
boolean
-movablerows
boolean
-movecolumncursor
cursor
-movecursor
cursor
-protecttitlecolumns
boolean
-resizablecolumns
boolean
-resizecursor
cursor
-selectmode mode
(single|browse|multiple|extended)
-selecttype
row|cell
-setfocus
boolean
-showarrow
boolean
-showlabels
boolean
-showseparators
boolean
-snipstring
string
-sortcommand
command
-spacing
screenDistance
-state
normal|disabled
-stretch
all|columnIndexList
-stripebackground
color or -stripebg
color
-stripeforeground
color or -stripefg
color
-stripeheight
lines
-takefocus
0|1|""|command
-targetcolor
color
-titlecolumns
number
-tooltipaddcommand
command
-tooltipdelcommand
command
-width
characters
DESCRIPTION
COLORS AND FONTS
COLUMN CONFIGURATION OPTIONS
-align
left|right|center
-background
color or -bg
color
-changesnipside
boolean
-editable
boolean
-editwindow
name
-font
font
-foreground
color or -fg
color
-formatcommand
command
-hide
boolean
-labelalign
left|right|center
-labelbackground
color or -labelbg
color
-labelborderwidth
screenDistance or -labelbd
screenDistance
-labelcommand
command
-labelcommand2
command
-labelfont
font
-labelforeground
color or -labelfg
color
-labelheight
lines
-labelimage
image
-labelpady
screenDistance
-labelrelief
raised|sunken|flat|ridge|solid|
groove
-maxwidth
width
-name
name
-resizable
boolean
-selectbackground
color
-selectforeground
color
-showarrow
boolean
-showlinenumbers
boolean
-sortcommand
command
-sortmode
ascii|command|dictionary|integer|real
-stretchable
boolean
-text
list
-title
title
-width
width
-wrap
boolean
ROW CONFIGURATION OPTIONS
-background
color or -bg
color
-font
font
-foreground
color or -fg
color
-hide
boolean
-name
name
-selectable
boolean
-selectbackground
color
-selectforeground
color
-text
list
CELL CONFIGURATION OPTIONS
-background
color or -bg
color
-editable
boolean
-editwindow
name
-font
font
-foreground
color or -fg
color
-image
image
-selectbackground
color
-selectforeground
color
-stretchwindow
boolean
-text
text
-window
command
-windowdestroy
command
INTERACTIVE CELL EDITING
ROW INDICES
-
number knumber active anchor end @x,y name
- COLUMN INDICES
-
number active anchor end @x,y name
- CELL INDICES
-
row,col active anchor end @x,y
row: number knumber active anchor end name
col: number active anchor end name
- WIDGET COMMAND
pathName activate
index
pathName activatecell cellIndex
pathName attrib
?name? ?value name value
...?
pathName bbox
index
pathName bodypath
pathName bodytag
pathName cancelediting
pathName cellcget
cellIndex option
pathName cellconfigure cellIndex
?option? ?value option value
...?
pathName cellindex
cellIndex
pathName cellselection option
args
pathName cellselection anchor
cellIndex
pathName cellselection clear
firstCell lastCell
pathName cellselection clear
cellIndexList
pathName cellselection includes
cellIndex
pathName cellselection set
firstCell lastCell
pathName cellselection set
cellIndexList
pathName cget
option
pathName columncget columnIndex
option
pathName columnconfigure columnIndex
?option? ?value option value
...?
pathName columncount
pathName columnindex columnIndex
pathName columnwidth columnIndex
?-requested|-stretched|-total?
pathName configcelllist {cellIndex
option value cellIndex option
value ...}
pathName configcells ?cellIndex option
value cellIndex option value
...?
pathName configcolumnlist {columnIndex
option value columnIndex option
value ...}
pathName configcolumns ?columnIndex
option value columnIndex option
value ...?
pathName configrowlist {index option
value index option value
...}
pathName configrows ?index option
value index option value
...?
pathName configure
?option? ?value option value
...?
pathName containing y
pathName containingcell x
y
pathName containingcolumn x
pathName curcellselection
pathName curselection
pathName delete
first last
pathName delete
indexList
pathName deletecolumns firstColumn
lastColumn
pathName deletecolumns
columnIndexList
pathName editcell
cellIndex
pathName editwinpath
pathName entrypath
pathName fillcolumn columnIndex
text
pathName finishediting
pathName formatinfo
pathName get
first last
pathName get
indexList
pathName getcells
firstCell lastCell
pathName getcells
cellIndexList
pathName getcolumns firstColumn
lastColumn
pathName getcolumns columnIndexList
pathName getkeys
first last
pathName getkeys
indexList
pathName imagelabelpath
cellIndex
pathName index
index
pathName insert
index ?item item ...?
pathName insertcolumnlist columnIndex
{width title ?left|right|center?
width title ?left|right|center?
...}
pathName insertcolumns columnIndex
?width title ?left|right|center?
width title ?left|right|center?
...?
pathName insertlist index
itemList
pathName iselemsnipped cellIndex
fullTextName
pathName istitlesnipped columnIndex
fullTextName
pathName itemlistvar
pathName labelpath
columnIndex
pathName labels
pathName move
source target
pathName movecolumn sourceColumn
targetColumn
pathName nearest
y
pathName nearestcell x y
pathName nearestcolumn x
pathName rejectinput
pathName resetsortinfo
pathName rowcget
index option
pathName rowconfigure index ?option?
?value option value ...?
pathName scan
mark|dragto x y
pathName see
index
pathName seecell
cellIndex
pathName seecolumn
columnIndex
pathName selection
option args
pathName selection anchor
index
pathName selection clear
first last
pathName selection clear
indexList
pathName selection includes
index
pathName selection set first
last
pathName selection set
indexList
pathName separatorpath
?columnIndex?
pathName separators
pathName size
pathName sort
?-increasing|-decreasing?
pathName sortbycolumn columnIndex
?-increasing|-decreasing?
pathName sortbycolumnlist columnIndexList
?sortOrderList?
pathName sortcolumn
pathName sortcolumnlist
pathName sortorder
pathName sortorderlist
pathName togglecolumnhide firstColumn
lastColumn
pathName togglecolumnhide
columnIndexList
pathName togglerowhide first
last
pathName togglerowhide indexList
pathName windowpath cellIndex
pathName xview
args
pathName xview
pathName xview units
pathName xview moveto
fraction
pathName xview scroll number
units|pages
pathName yview
args
pathName yview
pathName yview units
pathName yview moveto
fraction
pathName yview scroll number
units|pages
DEFAULT AND INDIVIDUAL BINDINGS FOR THE
TABLELIST BODY
DEFAULT BINDINGS FOR THE HEADER
LABELS
DEFAULT BINDINGS FOR INTERACTIVE CELL
EDITING
KEYWORDS
- tablelist, multi-column, listbox, widget
Detailed Reference
- 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. The
-highlightbackground,
-highlightcolor, and
-highlightthickness options are only supported
by the Tablelist package, but not by Tablelist_tile. When
using the package Tablelist_tile, the options
-selectbackground,
-selectborderwidth, and
-selectforeground have theme-specific default
values.
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. When using the package
Tablelist_tile, these options have theme-specific default
values.
WIDGET-SPECIFIC OPTIONS
| Command-Line Name: |
-activestyle |
| Database Name: |
activeStyle |
| Database Class: |
ActiveStyle |
Specifies how to diplay the active item or element (depending on
the value of the -selecttype configuration option) when
the tablelist has the keyboard focus. The allowed values are
frame, none, and
underline. The default value
frame shows a thin frame around the active item
or element, which in most cases looks nice. It looks less
pretty when applied to the active item if the background color of
some of its cells was changed by using the columnconfigure or cellconfigure widget command
and no column separators are shown. The value
none specifies that no special indication of
the active item or element is to be performed. The value
underline produces the same visual effect as in
the case of the Tk core 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 or sortbycolumnlist 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 depends on the windowing system in the Tablelist
package and on the current theme in Tablelist_tile. For
example, if the windowing system is x11 then
the default 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, because in this case the -arrowstyle option has the default
value sunken10x9). On the windowing
system win32, the default arrow color is
#aca899 for Windows XP and an empty string for older
Windows versions, paired with the default arrow style
flat9x5 and sunken8x7,
respectively. Finally, for the windowing systems
classic and aqua on the
Macintosh, the default arrow color is #777777 and the
default arrow style is flat7x7.
-
| Command-Line Name: |
-arrowstyle |
| Database Name: |
arrowStyle |
| Database Class: |
ArrowStyle |
Specifies the relief, width, and height of the up- or down-arrow
placed into a column label by the sortbycolumn or sortbycolumnlist subcommand of
the Tcl command associated with the widget. This option is
only relevant if the value of the -showarrow option is true. The
currently supported values are flat7x4,
flat7x5, flat7x7,
flat8x5, flat9x5,
sunken8x7, sunken10x9, and
sunken12x11. The default value depends on
the windowing system in the Tablelist package and on the current
theme in Tablelist_tile; see the description of the -arrowcolor option for
details.
-
| 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 or sortbycolumnlist 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. When
the default value of the -arrowcolor option is an empty string
then this is the default for the
-arrowdisabledcolor option, too; otherwise the
latter's default value equals the default foreground color of the
header labels in disabled state.
-
| 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 (but no larger than the maximum
width indicated by the -maxwidth column configuration
option). 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.
REMARK: Whenever possible, you should specify the
value zero for the column widths, i.e., use dynamic-width
columns. Besides being more user-friendly, dynamic-width
columns have the main advantage that they increase the performance
of the item insertion and sorting quite significantly.
-
| 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 embedded 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 edit
window, the resulting script is evaluated in the global scope, and
the return value becomes the cell's new contents after destroying
the temporary embedded widget. The main purpose of this
script is to perform a final validation of the edit window's
contents. See the description of the -forceeditendcommand option
for more about the invocation of the command mentioned above, as
well as 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
embedded widget used for the editing. The main purpose of
this script is to define validations for the edit window's
contents. See the INTERACTIVE CELL
EDITING section for details on the editing process.
-
| Command-Line Name: |
-forceeditendcommand |
| Database Name: |
forceEditEndCommand |
| Database Class: |
ForceEditEndCommand |
Specifies a boolean value that controls the invocation of the
command given by the the -editendcommand option. If
this value is true then the command will be invoked on normal
termination of the editing process even if the final text of the
temporary embedded widget used for the editing equals its initial
one, and will also be invoked when the interactive cell editing is
canceled (in the latter case, the text passed to it as last
argument will be the cell's original contents, not its final
one). The default value of this option is 0,
meaning that the command will only be invoked on normal termination
of the editing process, if the final text of the temporary embedded
widget is different from its initial one. See the INTERACTIVE CELL EDITING section for details on
the editing process.
Setting this option to true enables you to execute an arbitrary
action whenever the interactive cell editing is finished.
Just binding a script to the <Destroy>
event for the temporary embedded widget used for the editing won't
work, because that widget might be destroyed and recreated
automatically under various circumstances. Alternately, you
can use the
<<TablelistCellUpdated>> and
<<TablelistCellRestored>> virtual
events, generated by the finishediting and cancelediting subcommands,
respectively.
-
| 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
sorting the items based on that column in increasing order, with
the aid of the sortbycolumn or sortbycolumnlist subcommand of
the Tcl command associated with the widget. 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: |
-labelactivebackground |
| Database Name: |
labelActiveBackground |
| Database Class: |
Foreground |
Specifies the -activebackground option for
the header labels, i.e., the background color to use when the mouse
cursor is positioned over a header label and the value of
tk_strictMotif is false. This option is
only defined in the Tablelist package if the Tk version being used
supports the -activebackground option for label
widgets. This is checked by Tablelist at initialization time,
and will normally be the case for Tk versions 8.3.2 or
higher. On the other hand, the Tablelist_tile package doesn't
support the -labelactivebackground option.
-
| Command-Line Name: |
-labelactiveforeground |
| Database Name: |
labelActiveForeground |
| Database Class: |
Background |
Specifies the -activeforeground option for
the header labels, i.e., the foreground color to use when the mouse
cursor is positioned over a header label and the value of
tk_strictMotif is false. This option is
only defined in the Tablelist package if the Tk version being used
supports the -activeforeground option for label
widgets. This is checked by Tablelist at initialization time,
and will normally be the case for Tk versions 8.3.2 or
higher. On the other hand, the Tablelist_tile package doesn't
support the -labelactiveforeground option.
-
| Command-Line Name: |
-labelbackground or
-labelbg |
| Database Name: |
labelBackground |
| Database Class: |
Background |
Specifies the -background option for the
header labels. In the package Tablelist_tile this option has
a theme-specific default value.
-
| 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. In the package Tablelist_tile this option has
a theme-specific default value.
-
| 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: |
-labelcommand2 |
| Database Name: |
labelCommand2 |
| Database Class: |
LabelCommand2 |
Specifies the Tcl command to be invoked when mouse button 1 is
pressed together with the Shift key 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::addToSortColumns;
this command adds the column index passed to it as second argument
to the list of sort columns and sorts the items based on the
columns indicated by the modified list.
-
| 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
in the Tablelist package if the Tk version being used supports the
-disabledforeground option for label
widgets. This is checked by Tablelist at initialization time,
and will normally be the case for Tk versions 8.3.1 or
higher. On the other hand, the Tablelist_tile package doesn't
support the -labeldisabledforeground
option.
-
| Command-Line Name: |
-labelfont |
| Database Name: |
labelFont |
| Database Class: |
Font |
Specifies the -font option for the header
labels. In the package Tablelist_tile this option has a
theme-specific default value.
-
| Command-Line Name: |
-labelforeground or
-labelfg |
| Database Name: |
labelForeground |
| Database Class: |
Foreground |
Specifies the -foreground option for the
header labels. In the package Tablelist_tile this option has
a theme-specific default value.
-
| Command-Line Name: |
-labelheight |
| Database Name: |
labelHeight |
| Database Class: |
Height |
Specifies the -height option for the header
labels. This option is only supported by the Tablelist
package, but not by Tablelist_tile.
-
| Command-Line Name: |
-labelpady |
| Database Name: |
labelPadY |
| Database Class: |
Pad |
In the Tablelist package this option specifies the
-pady configuration option for the header
labels. In the Tablelist_tile package the value of the
-labelpady option is mapped to the
corresponding components of the value of the
-padding configuration option of the header
labels, and the -labelpady option has a
theme-specific default value.
-
| 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. The default value is raised.
-
| 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.
REMARK: For increased efficiency, updating the
widget to reflect a changed value of the variable specified with
this option is, whenever possible, done at idle time (i.e., when
there are no events to process). On the other hand, most
tablelist subcommands make it necessary to perform an
immediate update of the widget's internal list according to
the value of this variable, before executing the subcommand in
question. Doing this repeatedly can become quite
inefficient. To avoid performance problems, you should always
try to separate the operations that build up the value of the
variable specified by this option from other commands. For
example, instead of
tablelist::tablelist .tbl ... -listvariable var
set var {}
for {set row 0} {$row < 1000} {incr row} {
lappend var ...
.tbl cellconfigure $row,3 -image ...
}
you should write
tablelist::tablelist .tbl ... -listvariable var
set var {}
for {set row 0} {$row < 1000} {incr row} {
lappend var ...
}
for {set row 0} {$row < 1000} {incr row} {
.tbl cellconfigure $row,3 -image ...
}
The first method above is quite inefficient, because it requires
1000 updates of the widget's internal list. The second method
performs incomparably faster, because it needs only one
synchronization (at the beginning of the second loop).
-
| 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: |
-movablerows |
| Database Name: |
movableRows |
| Database Class: |
MovableRows |
Specifies a boolean value that determines whether the rows can
be moved interactively. See the DEFAULT AND INDIVIDUAL BINDINGS FOR THE TABLELIST
BODY section below for information on moving a row
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: |
-movecursor |
| Database Name: |
moveCursor |
| Database Class: |
MoveCursor |
Specifies the mouse cursor to be used when moving a row
interactively. The default value is
hand2.
-
| Command-Line Name: |
-protecttitlecolumns |
| Database Name: |
protectTitleColumns |
| Database Class: |
ProtectTitleColumns |
Specifies a boolean value that determines whether the boundary
of the title column area shall be protected from being crossed when
moving a column interactively. See the DEFAULT BINDINGS FOR THE HEADER LABELS
section below for information on moving a column
interactively. The default value is 0,
specifying that non-title columns can be moved into the title
column area and vice-versa.
-
| 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: |
-selecttype |
| Database Name: |
selectType |
| Database Class: |
SelectType |
Specifies one of two selection types for the tablelist widget:
row or cell. If the
selection type is row then the default bindings
will select and deselect entire items, and the whole row having the
location cursor will be displayed as active when the tablelist has
the keyboard focus. If the selection type is
cell then the default bindings will select and
deselect individual elements, and the single cell having the
location cursor will be displayed as active when the tablelist has
the keyboard focus. The default value is
row.
-
| Command-Line Name: |
-setfocus |
| Database Name: |
setFocus |
| Database Class: |
SetFocus |
Specifies a boolean value that determines whether a click with
the left mouse button anywhere into the tablelist's body, including
the separators and the embedded images (more precisely, any
descendants of the tablelist widget having the binding tag
TablelistBody)
should set the focus to the body of the tablelist widget if the
latter's state is
normal. The default value is
1.
-
| Command-Line Name: |
-showarrow |
| Database Name: |
showArrow |
| Database Class: |
ShowArrow |
Specifies a boolean value that determines whether the
sortbycolumn and
sortbycolumnlist subcommands of
the Tcl command associated with the widget should place an arrow
indicating the sort order into the header label(s) of the column(s)
specified by their 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 frames
with sunken relief in the package Tablelist, and as tile separator
widgets in the package Tablelist_tile. They are attached to
the right edges of the header labels, and 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: |
-spacing |
| Database Name: |
spacing |
| Database Class: |
Spacing |
Specifies additional space to provide above and below each row
of the widget. The option's value may have any of the
standard forms for screen distances. It defaults to
0.
-
| 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 neither items nor columns may be
inserted, deleted, updated, or moved, the items, header labels, and
the up- or down-arrow are drawn in the -disabledforeground, -labeldisabledforeground,
and -arrowdisabledcolor color,
respectively, the selection cannot be modified and is not shown
(although the selection information is retained), the header labels
are completely insensitive, and no interactive cell editing can be
performed.
-
| 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 non-hidden items,
according to the value of the -stripeheight configuration
option. The first stripeHeight non-hidden items
are "normal" ones; they are followed by a stripe composed of the
next stripeHeight non-hidden items, which in turn is
followed by the same number of "normal" non-hidden items, and so
on. In the Tablelist package and in most themes supported by
Tablelist_tile, the default value is an empty string, indicating
that the stripes will inherit the background color specified by the
-background
configuration option. When using Tablelist_tile with the
tileqt theme then the default value is given by
the global KDE option alternateBackground,
which in turn depends on the current color scheme. In this
case it is recommended to either keep that default value retrieved
from KDE, or to use an explicitly specified empty string if no
stripes are to be displayed. The
-stripebackground option has a higher priority
than the -background column configuration
option, but a lower priority than the
-background option specified at row or cell
level.
-
| 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. Each stripe is composed of the same
number stripeHeight of consecutive non-hidden items,
according to the value of the -stripeheight configuration
option. The first stripeHeight non-hidden items
are "normal" ones; they are followed by a stripe composed of the
next stripeHeight non-hidden items, which in turn is
followed by the same number of "normal" non-hidden items, and so
on. The default value is an empty string, indicating that the
stripes will inherit the foreground color specified by the
-foreground
configuration option. The
-stripeforeground option has a higher priority
than the -foreground column configuration
option, but a lower priority than the
-foreground option specified at row or cell
level.
-
| 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: |
-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 of 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: |
-targetcolor |
| Database Name: |
targetColor |
| Database Class: |
TargetColor |
Specifies the color of the temporary gap displayed in the
tablelist's body or header to indicate the target position when
moving a row or column interactively. The default value is
black.
-
| Command-Line Name: |
-titlecolumns |
| Database Name: |
titleColumns |
| Database Class: |
TitleColumns |
Specifies the number of the non-scrollable columns at the left
edge of the window, also called title columns. The
positions of these columns will not change when adjusting the
horizontal view by invoking the scan, seecell, seecolumn, or xview subcommand. The default value
is 0. The value of this option also determines
the scrolling unit used by the commands mentioned above when
shifting the horizontal view: if it is positive then the horizontal
scrolling is performed column-wise, otherwise by character units
(the width of the 0 character).
The end of the title column area is visualized with the aid of a
separator, attached to the right edge of the header label
corresponding to the last non-hidden title column. This
special separator is always displayed to mark the end of the title
columns (if any), independently of the value of the -showseparators option.
The user can easily distinguish it from the other separators by
means of its background color, which is different from that of the
other separator frames.
For technical reasons (the use of the -elide
option for a text widget tag), this option is not supported for Tk
versions earlier than 8.3.
-
| Command-Line Name: |
-tooltipaddcommand |
| Database Name: |
tooltipAddCommand |
| Database Class: |
TooltipAddCommand |
Specifies a Tcl command to be used for displaying cell- and
column label-specific balloon help. When the mouse pointer
enters a cell, the command is automatically concatenated with the
name of the tablelist widget and the cell's row and column indices,
and the resulting script is evaluated in the global scope.
Similarly, when the mouse pointer enters a header label, the
command is automatically concatenated with the name of the
tablelist widget, the number -1, and the column index
of the respective label, and the resulting script is evaluated in
the global scope. In both cases, the action described above
is only triggered if both the value of this option and that of
-tooltipdelcommand are nonempty
strings.
For example, consider the procedure tooltipAddCmd
shown below, which makes use of the DynamicHelp::add
command from the BWidget package to display the full cell and label
texts as tooltips for the cells and header labels with snipped
contents.
proc tooltipAddCmd {tbl row col} {
if {($row >= 0 && [$tbl iselemsnipped $row,$col fullText]) ||
($row < 0 && [$tbl istitlesnipped $col fullText])} {
DynamicHelp::add $tbl -text $fullText
}
}
A tablelist widget can use this procedure by specifying
-tooltipaddcommand tooltipAddCmd -tooltipdelcommand DynamicHelp::delete
If you prefer to use the tooltip::tooltip command
from the tooltip package contained in tklib then the procedure
becomes
proc tooltipAddCmd {tbl row col} {
if {($row >= 0 && [$tbl iselemsnipped $row,$col fullText]) ||
($row < 0 && [$tbl istitlesnipped $col fullText])} {
tooltip::tooltip $tbl $fullText
}
}
and can be used by specifying
-tooltipaddcommand tooltipAddCmd -tooltipdelcommand "tooltip::tooltip clear"
Both versions above make use of the iselemsnipped and istitlesnipped subcommands, to
make sure that the full cell and label texts will only be displayed
for those cells and header labels whose contents are snipped.
-
| Command-Line Name: |
-tooltipdelcommand |
| Database Name: |
tooltipDelCommand |
| Database Class: |
TooltipDelCommand |
Specifies a Tcl command to be used for removing the cell- or
column label-specific balloon help. When the mouse pointer
leaves a cell or a header label, the command specified by this
option is automatically concatenated with the name of the tablelist
widget and the resulting script is evaluated in the global
scope. This action is only triggered if both the value of
this option and that of -tooltipaddcommand are nonempty
strings. Common values for this option are
"DynamicHelp::delete" (which requires the BWidget
package) and "tooltip::tooltip clear"
(which requires the tooltip package contained in tklib).
Their usage is shown in the examples above.
-
| 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 column's alignment. Instead of an image, a
tablelist cell can also contain an embedded window, placed to the
left or right of the text, just like an embedded image.
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. Per
default, 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. A great variety of widgets from the packages
BWidget, Iwidgets, combobox (by Bryan Oakley), and Mentry (or
Mentry_tile), as well as Tk core text, spinbox and checkbutton
widgets along with tile entry, combobox, and checkbutton widgets
are also supported as temporary embedded widgets used for cell
editing. 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 or elements
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 types
STRING and UTF8_STRING; the
value of the selection will be a text built by taking all of the
rows having at least one non-hidden selected element, joining these
elements together with tabs, and the resulting strings in turn with
newlines. If a tablelist widget that is exporting its
selection is the selection owner and some other window claims
ownership of the selection away from it, then the virtual event
<<TablelistSelectionLost>> is
generated.
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.
COLORS AND FONTS
- 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.
- COLUMN CONFIGURATION
OPTIONS
- The following options are currently supported by the
columncget,
columnconfigure,
configcolumnlist, and
configcolumns
commands:
-
-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.
-changesnipside
boolean
- Specifies whether to override the alignment-specific default
position of the snip indicator when
displaying the elements of the column (excluding its title).
The default value is
0, meaning that the snip string
will be appended to the elements if the column's alignment is
left or center and
prepended to them in case the alignment is
right.
-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 of
the same name.
-editwindow
name
- Specifies the type of the temporary embedded widget to be used
for interactive editing of the contents of the given column's
cells.
name may be one of
entry (which is the default),
text, spinbox (the latter
for Tk version 8.4 or higher), checkbutton,
ttk::entry, ttk::combobox,
or ttk::checkbutton (the latter three only in
the presence of the tile widget engine), or the value returned by
one of the registration commands for widgets from the packages BWidget, Iwidgets, combobox (by Bryan Oakley), and Mentry (or Mentry_tile). For
example, you can use -editwindow
ComboBox after registering the ComboBox
widget for interactive cell editing with the aid of the tablelist::addBWidgetComboBox
command. Similarly, you can use -editwindow
combobox after registering Bryan Oakley's
combobox widget for interactive cell editing by invoking the
tablelist::addOakleyCombobox
command. The value of this option can be overridden for
individual cells by using the cell
configuration option of 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 a Tcl command to be invoked when displaying the
contents of a cell within this column or adding them 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, getcells, rowcget, columncget, cellcget, sort, sortbycolumn, and sortbycolumnlist 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.
The -formatcommand option comes in handy if
only images or embedded windows are to be displayed in a column but
the texts associated with the cells may not simply be empty strings
because they are needed for other purposes (like sorting or
editing). In such cases, a procedure returning an empty
string can be used as the option's value, thus making sure that the
textual information contained in that column remains hidden.
In the more sophisticated case that the result of the formatting
should also depend on the cell's row, you will have to invoke the
formatinfo
subcommand, which provides the necessary information about the cell
whose content is being formatted.
-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 screenDistance or
-labelbd screenDistance
-labelcommand command
-labelcommand2 command
-labelfont fontName
-labelforeground color or
-labelfg color
-labelheight lines
-labelpady screenDistance
-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 of 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 of the same name will be used instead. The
-labelactivebackground,
-labelactiveforeground, and
-labeldisabledforeground
options are only defined at widget level; there are no column
configuration options with these names. The
-labelheight option is only supported by the
Tablelist package, but not by Tablelist_tile.
-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
label's font.
-maxwidth
width
width must be a number. A positive
value specifies the column's maximum width in average-size
characters of the widget's font. If width
is negative, its absolute value is interpreted as a maximum column
width in pixels. Finally, a value of zero (which is the
default) specifies that the column's maximum width is to be made
just large enough to hold all the elements in the column, including
its header. This option is only relevant if the given column
has dynamic width, i.e., if its width was set to
0.
-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
ambiguities, column names should be different from any other forms
of column indices (like numbers, active,
anchor, end, or any of
their abbreviations). 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 is
selected.
-selectforeground
color
- Specifies the foreground color to use when displaying the
contents of a cell in the given column while the cell is
selected.
-showarrow
boolean
- Specifies whether the
sortbycolumn command with the given
column index as first argument and the sortbycolumnlist command having
the given column index as element of its first argument should
place an arrow indicating the sort 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.
-showlinenumbers
boolean
- Specifies whether the given column should display the line
numbers (starting with 1 and ending with the number of the
non-hidden rows). The default value is
0.
The following details assume that the given column's
-showlinenumbers option was set to true:
Associating the line numbers with the non-hidden rows takes place
automatically whenever items are inserted, deleted, updated, moved,
or sorted. For increased efficiency, this is in most cases
done at idle time. For example, if several items are inserted
into or deleted from the tablelist widget, then the necessary
renumbering of the non-hidden rows will be performed as an idle
callback, the next time the event loop is entered and there are no
events to process. The line numbers will override any
previous contents of the column's cells. They are, per
default, displayed without leading zeros, but this (and the display
format in general) can be changed with the aid of the -formatcommand column
configuration option.
The sortbycolumn
and sortbycolumnlist subcommands as
well as the tablelist::sortByColumn
and tablelist::addToSortColumns
commands check the column indices passed to them as arguments and
don't perform any sorting by those columns that have been
configured to display the line numbers (see the corresponding
descriptions for details).
-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 or the sortbycolumnlist command having
the given column index as element of its first argument. To
compare two elements during the sortbycolumn or
sortbycolumnlist 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 or the
sortbycolumnlist command having
the given column index as element of its 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. |
-stretchable
boolean
- Specifies whether the column is to be stretched in order to
fill the tablelist window if necessary. The value of this
option is tied to that of the
-stretch option for the tablelist widget;
changes in either will automatically be reflected in the
other.
-text list
- Specifies a list of strings to be displayed in the cells of the
given column, i.e., updat
| |