summaryrefslogtreecommitdiffstats
path: root/doc/listbox.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/listbox.n')
-rw-r--r--doc/listbox.n56
1 files changed, 20 insertions, 36 deletions
diff --git a/doc/listbox.n b/doc/listbox.n
index e287b09..341ce9a 100644
--- a/doc/listbox.n
+++ b/doc/listbox.n
@@ -14,24 +14,20 @@ listbox \- Create and manipulate listbox widgets
.SH SYNOPSIS
\fBlistbox\fR \fIpathName \fR?\fIoptions\fR?
.SO
-\-activestyle \-height \-selectforeground
-\-background \-highlightbackground \-setgrid
-\-borderwidth \-highlightcolor \-state
-\-cursor \-highlightthickness \-takefocus
-\-disabledforeground \-relief \-width
-\-exportselection \-selectbackground \-xscrollcommand
-\-font \-selectborderwidth \-yscrollcommand
-\-foreground
+\-background \-borderwidth \-cursor
+\-disabledforeground \-exportselection \-font
+\-foreground \-highlightbackground \-highlightcolor
+\-highlightthickness \-relief \-selectbackground
+\-selectborderwidth \-selectforeground \-setgrid
+\-takefocus \-xscrollcommand \-yscrollcommand
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
-.VS 8.4
.OP \-activestyle activeStyle ActiveStyle
Specifies the style in which to draw the active element. This must be
one of \fBdotbox\fR (show a focus ring around the active element),
\fBnone\fR (no special indication of active element) or
\fBunderline\fR (underline the active element).
-The default is \fBunderline\fR.
-.VS 8.4
+The default is \fBunderline\fR on Windows, and \fBdotbox\fR elsewhere.
.OP \-height height Height
Specifies the desired height for the window, in lines.
If zero or less, then the desired height for the window is made just
@@ -51,17 +47,16 @@ or \fBextended\fR; the default value is \fBbrowse\fR.
.OP \-state state State
Specifies one of two states for the listbox: \fBnormal\fR or \fBdisabled\fR.
If the listbox is disabled then items may not be inserted or deleted,
-items are drawn in the \fB-disabledforeground\fR color, and selection
+items are drawn in the \fB\-disabledforeground\fR color, and selection
cannot be modified and is not shown (though selection information is retained).
.OP \-width width Width
Specifies the desired width for the window in characters.
-If the font doesn't have a uniform width then the width of the
-character ``0'' is used in translating from character units to
-screen units.
+If the font does not have a uniform width then the width of the character
+.QW 0
+is used in translating from character units to screen units.
If zero or less, then the desired width for the window is made just
large enough to hold all the elements in the listbox.
.BE
-
.SH DESCRIPTION
.PP
The \fBlistbox\fR command creates a new window (given by the
@@ -93,7 +88,6 @@ may be used to change the view in the window. Listboxes allow
scrolling in both directions using the standard \fBxScrollCommand\fR
and \fByScrollCommand\fR options.
They also support scanning, as described below.
-
.SH "INDICES"
.PP
Many of the widget commands for listboxes take one or more indices
@@ -117,11 +111,9 @@ Indicates the anchor point for the selection, which is set with the
.TP 12
\fBend\fR
Indicates the end of the listbox.
-.VS 8.0
For most commands this refers to the last element in the listbox,
but for a few commands such as \fBindex\fR and \fBinsert\fR
it refers to the element just after the last one.
-.VE
.TP 12
\fB@\fIx\fB,\fIy\fR
Indicates the element that covers the point in the listbox window
@@ -132,7 +124,6 @@ point is used.
In the widget command descriptions below, arguments named \fIindex\fR,
\fIfirst\fR, and \fIlast\fR always contain text indices in one of
the above forms.
-
.SH "WIDGET COMMAND"
.PP
The \fBlistbox\fR command creates a new Tcl command whose
@@ -148,10 +139,8 @@ commands are possible for listbox widgets:
.TP
\fIpathName \fBactivate\fR \fIindex\fR
Sets the active element to the one indicated by \fIindex\fR.
-.VS 8.0
If \fIindex\fR is outside the range of elements in the listbox
then the closest element is activated.
-.VE
The active element is drawn as specified by \fB\-activestyle\fR when the
widget has the input focus, and its index may be retrieved with the
index \fBactive\fR.
@@ -165,9 +154,7 @@ of the upper-left corner of the screen area covered by the text
elements give the width and height of the area, in pixels.
If no part of the element given by \fIindex\fR is visible on the
screen,
-.VS 8.0
or if \fIindex\fR refers to a non-existent element,
-.VE
then the result is an empty string; if the element is
partially visible, the result gives the full area of the element,
including any parts that are not visible.
@@ -201,15 +188,13 @@ string is returned.
\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
Deletes one or more elements of the listbox. \fIFirst\fR and \fIlast\fR
are indices specifying the first and last elements in the range
-to delete. If \fIlast\fR isn't specified it defaults to
+to delete. If \fIlast\fR is not specified it defaults to
\fIfirst\fR, i.e. a single element is deleted.
.TP
\fIpathName \fBget \fIfirst\fR ?\fIlast\fR?
If \fIlast\fR is omitted, returns the contents of the listbox
element indicated by \fIfirst\fR,
-.VS 8.0
or an empty string if \fIfirst\fR refers to a non-existent element.
-.VE
If \fIlast\fR is specified, the command returns a list whose elements
are all of the listbox elements between \fIfirst\fR and \fIlast\fR,
inclusive.
@@ -218,10 +203,8 @@ forms for indices.
.TP
\fIpathName \fBindex \fIindex\fR
Returns the integer index value that corresponds to \fIindex\fR.
-.VS 8.0
If \fIindex\fR is \fBend\fR the return value is a count of the number
of elements in the listbox (not the index of the last element).
-.VE
.TP
\fIpathName \fBinsert \fIindex \fR?\fIelement element ...\fR?
Inserts zero or more new elements in the list just before the
@@ -308,10 +291,8 @@ has several forms, depending on \fIoption\fR:
.TP
\fIpathName \fBselection anchor \fIindex\fR
Sets the selection anchor to the element given by \fIindex\fR.
-.VS 8.0
If \fIindex\fR refers to a non-existent element, then the closest
element is used.
-.VE
The selection anchor is the end of the selection that is fixed
while dragging out a selection with the mouse.
The index \fBanchor\fR may be used to refer to the anchor
@@ -325,7 +306,7 @@ this range.
.TP
\fIpathName \fBselection includes \fIindex\fR
Returns 1 if the element indicated by \fIindex\fR is currently
-selected, 0 if it isn't.
+selected, 0 if it is not.
.TP
\fIpathName \fBselection set \fIfirst \fR?\fIlast\fR?
Selects all of the elements in the range between
@@ -418,7 +399,6 @@ If \fInumber\fR is negative then earlier elements
become visible; if it is positive then later elements
become visible.
.RE
-
.SH "DEFAULT BINDINGS"
.PP
Tk automatically creates class bindings for listboxes that give them
@@ -432,6 +412,10 @@ In both modes, clicking button 1 on an element selects
it and deselects any other selected item.
In \fBbrowse\fR mode it is also possible to drag the selection
with button 1.
+.VS 8.5
+On button 1, the listbox will also take focus if it has a \fBnormal\fR
+state and \fB\-takefocus\fR is true.
+.VE 8.5
.PP
If the selection mode is \fBmultiple\fR or \fBextended\fR,
any number of elements may be selected at once, including discontiguous
@@ -464,7 +448,7 @@ the button down.
In \fBextended\fR mode, pressing button 1 with the Control key down
starts a toggle operation: the anchor is set to the element under
the mouse, and its selection state is reversed. The selection state
-of other elements isn't changed.
+of other elements is not changed.
If the mouse is dragged with button 1 down, then the selection state
of all elements between the anchor and the element under the mouse
is set to match that of the anchor element; the selection state of
@@ -545,10 +529,10 @@ Control-backslash deselects everything in the widget, except in
The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is
a selection.
-
.PP
The behavior of listboxes can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH "SEE ALSO"
+ttk_treeview(n)
.SH KEYWORDS
listbox, widget