home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Listbox - Create and manipulate Listbox widgets</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Listbox - Create and manipulate Listbox widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#standard options">STANDARD OPTIONS</A></LI>
- <LI><A HREF="#widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#indices">INDICES</A></LI>
- <LI><A HREF="#widget methods">WIDGET METHODS</A></LI>
- <LI><A HREF="#default bindings">DEFAULT BINDINGS</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Listbox - Create and manipulate Listbox widgets</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P><EM>$listbox</EM> = <EM>$parent</EM>-><STRONG>Listbox</STRONG>(?<EM>options</EM>?);</P>
- <P>
- <HR>
- <H1><A NAME="standard options">STANDARD OPTIONS</A></H1>
- <P><TABLE CELLSPACING=0 CELLPADDING=0><TR><TD><STRONG>-background</STRONG><TD><STRONG>-foreground</STRONG><TD><STRONG>-relief</STRONG><TD><STRONG>-takefocus</STRONG>
- <TR><TD><STRONG>-borderwidth</STRONG><TD><STRONG>-height</STRONG><TD><STRONG>-selectbackground</STRONG><TD><STRONG>-width</STRONG>
- <TR><TD><STRONG>-cursor</STRONG><TD><STRONG>-highlightbackground</STRONG><TD><STRONG>-selectborderwidth</STRONG><TD><STRONG>-xscrollcommand</STRONG>
- <TR><TD><STRONG>-exportselection</STRONG><TD><STRONG>-highlightcolor</STRONG><TD><STRONG>-selectforeground</STRONG><TD><STRONG>-yscrollcommand</STRONG>
- <TR><TD><STRONG>-font</STRONG><TD><STRONG>-highlightthickness</STRONG><TD><STRONG>-setgrid</STRONG></TABLE></P>
- <P>See <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> for details of the standard options.</P>
- <P>
- <HR>
- <H1><A NAME="widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_Name%3A_height">Name: <STRONG>height</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Height">Class: <STRONG>Height</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dheight">Switch: <STRONG>-height</STRONG></A></STRONG><BR>
- <DD>
- 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 all the elements in the listbox.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_selectMode">Name: <STRONG>selectMode</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_SelectMode">Class: <STRONG>SelectMode</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dselectmode">Switch: <STRONG>-selectmode</STRONG></A></STRONG><BR>
- <DD>
- 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 <STRONG>single</STRONG>, <STRONG>browse</STRONG>, <STRONG>multiple</STRONG>,
- or <STRONG>extended</STRONG>; the default value is <STRONG>browse</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_width">Name: <STRONG>width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Width">Class: <STRONG>Width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dwidth">Switch: <STRONG>-width</STRONG></A></STRONG><BR>
- <DD>
- 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 zero or less, then the desired width for the window is made just
- large enough to hold all the elements in the listbox.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <STRONG>Listbox</STRONG> method creates a new window (given by the
- $widget argument) and makes it into a listbox widget.
- Additional
- options, described above, may be specified on the command line
- or in the option database
- to configure aspects of the listbox such as its colors, font,
- text, and relief. The <STRONG>listbox</STRONG> command returns its
- $widget argument. At the time this command is invoked,
- there must not exist a window named $widget, but
- $widget's parent must exist.</P>
- <P>A listbox is a widget that displays a list of strings, one per line.
- When first created, a new listbox has no elements.
- Elements may be added or deleted using methods described
- below. In addition, one or more elements may be selected as described
- below.
- If a listbox is exporting its selection (see <STRONG>exportSelection</STRONG>
- option), then it will observe the standard X11 protocols
- for handling the selection.
- Listbox selections are available as type <STRONG>STRING</STRONG>;
- the value of the selection will be the text of the selected elements, with
- newlines separating the elements.</P>
- <P>It is not necessary for all the elements to be
- displayed in the listbox window at once; commands described below
- may be used to change the view in the window. Listboxes allow
- scrolling in both directions using the standard <STRONG>xScrollCommand</STRONG>
- and <STRONG>yScrollCommand</STRONG> options.
- They also support scanning, as described below.</P>
- <P>
- <HR>
- <H1><A NAME="indices">INDICES</A></H1>
- <P>Many of the methods for listboxes take one or more indices
- as arguments.
- An index specifies a particular element of the listbox, in any of
- the following ways:</P>
- <DL>
- <DT><STRONG><A NAME="item_number"><EM>number</EM></A></STRONG><BR>
- <DD>
- Specifies the element as a numerical index, where 0 corresponds
- to the first element in the listbox.
- <P></P>
- <DT><STRONG><A NAME="item_active"><STRONG>active</STRONG></A></STRONG><BR>
- <DD>
- Indicates the element that has the location cursor. This element
- will be displayed with an underline when the listbox has the
- keyboard focus, and it is specified with the <STRONG>activate</STRONG>
- method.
- <P></P>
- <DT><STRONG><A NAME="item_anchor"><STRONG>anchor</STRONG></A></STRONG><BR>
- <DD>
- Indicates the anchor point for the selection, which is set with the
- <STRONG>selection anchor</STRONG> method.
- <P></P>
- <DT><STRONG><A NAME="item_end"><STRONG>end</STRONG></A></STRONG><BR>
- <DD>
- Indicates the end of the listbox.
- For most commands this refers to the last element in the listbox,
- but for a few commands such as <STRONG>index</STRONG> and <STRONG>insert</STRONG>
- it refers to the element just after the last one.
- <P></P>
- <DT><STRONG><A NAME="item_%40x%2Cy"><STRONG>@</STRONG><EM>x</EM><STRONG>,</STRONG><EM>y</EM></A></STRONG><BR>
- <DD>
- Indicates the element that covers the point in the listbox window
- specified by <EM>x</EM> and <EM>y</EM> (in pixel coordinates). If no
- element covers that point, then the closest element to that
- point is used.
- <P></P></DL>
- <P>In the method descriptions below, arguments named <EM>index</EM>,
- <EM>first</EM>, and <EM>last</EM> always contain text indices in one of
- the above forms.</P>
- <P>
- <HR>
- <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
- <P>The <STRONG>Listbox</STRONG> method creates a widget object.
- This object supports the <STRONG>configure</STRONG> and <STRONG>cget</STRONG> methods
- described in <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> which can be used to enquire and
- modify the options described above.
- The widget also inherits all the methods provided by the generic
- <A HREF="../../../site/lib/Tk/Widget.html">Tk::Widget</A> class.</P>
- <P>The following additional methods are available for listbox widgets:</P>
- <DL>
- <DT><STRONG><A NAME="item_activate"><EM>$listbox</EM>-><STRONG>activate</STRONG>(<EM>index</EM>)</A></STRONG><BR>
- <DD>
- Sets the active element to the one indicated by <EM>index</EM>.
- If <EM>index</EM> is outside the range of elements in the listbox
- then the closest element is activated.
- The active element is drawn with an underline when the widget
- has the input focus, and its index may be retrieved with the
- index <STRONG>active</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_bbox"><EM>$listbox</EM>-><STRONG>bbox</STRONG>(<EM>index</EM>)</A></STRONG><BR>
- <DD>
- Returns a list of four numbers describing the bounding box of
- the text in the element given by <EM>index</EM>.
- 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 text
- (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 element given by <EM>index</EM> is visible on the
- screen,
- or if <EM>index</EM> refers to a non-existent element,
- 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.
- <P></P>
- <DT><STRONG><A NAME="item_curselection"><EM>$listbox</EM>-><STRONG>curselection</STRONG></A></STRONG><BR>
- <DD>
- Returns a list containing the numerical indices of
- all of the elements in the listbox that are currently selected.
- If there are no elements selected in the listbox then an empty
- string is returned.
- <P></P>
- <DT><STRONG><A NAME="item_delete"><EM>$listbox</EM>-><STRONG>delete</STRONG>(<EM>first, </EM>?<EM>last</EM>?)</A></STRONG><BR>
- <DD>
- Deletes one or more elements of the listbox. <EM>First</EM> and <EM>last</EM>
- are indices specifying the first and last elements in the range
- to delete. If <EM>last</EM> isn't specified it defaults to
- <EM>first</EM>, i.e. a single element is deleted.
- <P></P>
- <DT><STRONG><A NAME="item_get"><EM>$listbox</EM>-><STRONG>get</STRONG>(<EM>first, </EM>?<EM>last</EM>?)</A></STRONG><BR>
- <DD>
- If <EM>last</EM> is omitted, returns the contents of the listbox
- element indicated by <EM>first</EM>,
- or an empty string if <EM>first</EM> refers to a non-existent element.
- If <EM>last</EM> is specified, the command returns a list whose elements
- are all of the listbox elements between <EM>first</EM> and <EM>last</EM>,
- inclusive.
- Both <EM>first</EM> and <EM>last</EM> may have any of the standard
- forms for indices.
- <P></P>
- <DT><STRONG><A NAME="item_index"><EM>$listbox</EM>-><STRONG>index</STRONG>(<EM>index</EM>)</A></STRONG><BR>
- <DD>
- Returns the integer index value that corresponds to <EM>index</EM>.
- If <EM>index</EM> is <STRONG>end</STRONG> the return value is a count of the number
- of elements in the listbox (not the index of the last element).
- <P></P>
- <DT><STRONG><A NAME="item_insert"><EM>$listbox</EM>-><STRONG>insert</STRONG>(<EM>index, </EM>?<EM>element, element, ...</EM>?)</A></STRONG><BR>
- <DD>
- Inserts zero or more new elements in the list just before the
- element given by <EM>index</EM>. If <EM>index</EM> is specified as
- <STRONG>end</STRONG> then the new elements are added to the end of the
- list. Returns an empty string.
- <P></P>
- <DT><STRONG><A NAME="item_nearest"><EM>$listbox</EM>-><STRONG>nearest</STRONG>(<EM>y</EM>)</A></STRONG><BR>
- <DD>
- Given a y-coordinate within the listbox window, this command returns
- the index of the (visible) listbox element nearest to that y-coordinate.
- <P></P>
- <DT><STRONG><A NAME="item_scan"><EM>$listbox</EM>-><STRONG>scan</STRONG>(<EM>option, args</EM>)</A></STRONG><BR>
- <DD>
- This command is used to implement scanning on listboxes. It has
- two forms, depending on <EM>option</EM>:
- <DL>
- <DT><STRONG><A NAME="item_scanMark"><EM>$listbox</EM>-><STRONG>scanMark</STRONG>(<EM>x, y</EM>)</A></STRONG><BR>
- <DD>
- Records <EM>x</EM> and <EM>y</EM> and the current view in the listbox
- window; used in conjunction with later <STRONG>scan dragto</STRONG> commands.
- Typically this command is associated with a mouse button press in
- the widget. It returns an empty string.
- <P></P>
- <DT><STRONG><A NAME="item_scanDragto"><EM>$listbox</EM>-><STRONG>scanDragto</STRONG>(<EM>x, y</EM>.)</A></STRONG><BR>
- <DD>
- This command computes the difference between its <EM>x</EM> and <EM>y</EM>
- arguments and the <EM>x</EM> and <EM>y</EM> arguments to the last
- <STRONG>scan mark</STRONG> command for the widget.
- It then adjusts the view by 10 times the
- difference in coordinates. This command is typically associated
- with mouse motion events in the widget, to produce the effect of
- dragging the list at high speed through the window. The return
- value is an empty string.
- <P></P></DL>
- <DT><STRONG><A NAME="item_see"><EM>$listbox</EM>-><STRONG>see</STRONG>(<EM>index</EM>)</A></STRONG><BR>
- <DD>
- Adjust the view in the listbox so that the element given by <EM>index</EM>
- is visible.
- If the element is already visible then the command has no effect;
- if the element is near one edge of the window then the listbox
- scrolls to bring the element into view at the edge; otherwise
- the listbox scrolls to center the element.
- <P></P>
- <DT><STRONG><A NAME="item_selection"><EM>$listbox</EM>-><STRONG>selection</STRONG>(<EM>option, arg</EM>)</A></STRONG><BR>
- <DD>
- This command is used to adjust the selection within a listbox. It
- has several forms, depending on <EM>option</EM>:
- <DL>
- <DT><STRONG><A NAME="item_selectionAnchor"><EM>$listbox</EM>-><STRONG>selectionAnchor</STRONG>(<EM>index</EM>)</A></STRONG><BR>
- <DD>
- Sets the selection anchor to the element given by <EM>index</EM>.
- If <EM>index</EM> refers to a non-existent element, then the closest
- element is used.
- The selection anchor is the end of the selection that is fixed
- while dragging out a selection with the mouse.
- The index <STRONG>anchor</STRONG> may be used to refer to the anchor
- element.
- <P></P>
- <DT><STRONG><A NAME="item_selectionClear"><EM>$listbox</EM>-><STRONG>selectionClear</STRONG>(<EM>first, </EM>?<EM>last</EM>?)</A></STRONG><BR>
- <DD>
- If any of the elements between <EM>first</EM> and <EM>last</EM>
- (inclusive) are selected, they are deselected.
- The selection state is not changed for elements outside
- this range.
- <P></P>
- <DT><STRONG><A NAME="item_selectionIncludes"><EM>$listbox</EM>-><STRONG>selectionIncludes</STRONG>(<EM>index</EM>)</A></STRONG><BR>
- <DD>
- Returns 1 if the element indicated by <EM>index</EM> is currently
- selected, 0 if it isn't.
- <P></P>
- <DT><STRONG><A NAME="item_selectionSet"><EM>$listbox</EM>-><STRONG>selectionSet</STRONG>(<EM>first, </EM>?<EM>last</EM>?)</A></STRONG><BR>
- <DD>
- Selects all of the elements in the range between
- <EM>first</EM> and <EM>last</EM>, inclusive, without affecting
- the selection state of elements outside that range.
- <P></P></DL>
- <DT><STRONG><A NAME="item_size"><EM>$listbox</EM>-><STRONG>size</STRONG></A></STRONG><BR>
- <DD>
- Returns a decimal string indicating the total number of elements
- in the listbox.
- <P></P>
- <DT><STRONG><A NAME="item_xview"><EM>$listbox</EM>-><STRONG>xview</STRONG>(<EM>args</EM>)</A></STRONG><BR>
- <DD>
- 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:
- <DL>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>xview</STRONG></STRONG><BR>
- <DD>
- 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 listbox'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 <STRONG>-xscrollcommand</STRONG>
- option.
- <P></P>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>xview</STRONG>(<EM>index</EM>)</STRONG><BR>
- <DD>
- Adjusts the view in the window so that the character position given by
- <EM>index</EM> is displayed at the left edge of the window.
- Character positions are defined by the width of the character <STRONG>0</STRONG>.
- <P></P>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>xview</STRONG>(<STRONG>moveto</STRONG> => <EM>fraction</EM>)</STRONG><BR>
- <DD>
- Adjusts the view in the window so that <EM>fraction</EM> of the
- total width of the listbox text is off-screen to the left.
- <EM>fraction</EM> must be a fraction between 0 and 1.
- <P></P>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>xview</STRONG>(<STRONG>scroll</STRONG> => <EM>number, what</EM>)</STRONG><BR>
- <DD>
- This command shifts the view in the window left or right according to
- <EM>number</EM> and <EM>what</EM>.
- <EM>Number</EM> must be an integer.
- <EM>What</EM> must be either <STRONG>units</STRONG> or <STRONG>pages</STRONG> or an abbreviation
- of one of these.
- If <EM>what</EM> is <STRONG>units</STRONG>, the view adjusts left or right by
- <EM>number</EM> character units (the width of the <STRONG>0</STRONG> character)
- on the display; if it is <STRONG>pages</STRONG> then the view adjusts by
- <EM>number</EM> screenfuls.
- If <EM>number</EM> is negative then characters farther to the left
- become visible; if it is positive then characters farther to the right
- become visible.
- <P></P></DL>
- <DT><STRONG><A NAME="item_yview"><EM>$listbox</EM>-><STRONG>yview</STRONG>(<EM>?args</EM>?)</A></STRONG><BR>
- <DD>
- This command is used to query and change the vertical position of the
- text in the widget's window.
- It can take any of the following forms:
- <DL>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>yview</STRONG></STRONG><BR>
- <DD>
- Returns a list containing two elements, both of which are real fractions
- between 0 and 1.
- The first element gives the position of the listbox element at the
- top of the window, relative to the listbox as a whole (0.5 means
- it is halfway through the listbox, for example).
- The second element gives the position of the listbox element just after
- the last one in the window, relative to the listbox as a whole.
- These are the same values passed to scrollbars via the <STRONG>-yscrollcommand</STRONG>
- option.
- <P></P>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>yview</STRONG>(<EM>index</EM>)</STRONG><BR>
- <DD>
- Adjusts the view in the window so that the element given by
- <EM>index</EM> is displayed at the top of the window.
- <P></P>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>yview</STRONG>(<STRONG>moveto</STRONG> => <EM>fraction</EM>)</STRONG><BR>
- <DD>
- Adjusts the view in the window so that the element given by <EM>fraction</EM>
- appears at the top of the window.
- <EM>Fraction</EM> is a fraction between 0 and 1; 0 indicates the first
- element in the listbox, 0.33 indicates the element one-third the
- way through the listbox, and so on.
- <P></P>
- <DT><STRONG><EM>$listbox</EM>-><STRONG>yview</STRONG>(<STRONG>scroll</STRONG> => <EM>number, what</EM>)</STRONG><BR>
- <DD>
- This command adjusts the view in the window up or down according to
- <EM>number</EM> and <EM>what</EM>.
- <EM>Number</EM> must be an integer.
- <EM>What</EM> must be either <STRONG>units</STRONG> or <STRONG>pages</STRONG>.
- If <EM>what</EM> is <STRONG>units</STRONG>, the view adjusts up or down by
- <EM>number</EM> lines; if it is <STRONG>pages</STRONG> then
- the view adjusts by <EM>number</EM> screenfuls.
- If <EM>number</EM> is negative then earlier elements
- become visible; if it is positive then later elements
- become visible.
- <P></P></DL>
- </DL>
- <P>
- <HR>
- <H1><A NAME="default bindings">DEFAULT BINDINGS</A></H1>
- <P>Tk automatically creates class bindings for listboxes that give them
- Motif-like behavior. Much of the behavior of a listbox is determined
- by its <STRONG>selectMode</STRONG> option, which selects one of four ways
- of dealing with the selection.</P>
- <P>If the selection mode is <STRONG>single</STRONG> or <STRONG>browse</STRONG>, at most one
- element can be selected in the listbox at once.
- In both modes, clicking button 1 on an element selects
- it and deselects any other selected item.
- In <STRONG>browse</STRONG> mode it is also possible to drag the selection
- with button 1.</P>
- <P>If the selection mode is <STRONG>multiple</STRONG> or <STRONG>extended</STRONG>,
- any number of elements may be selected at once, including discontiguous
- ranges. In <STRONG>multiple</STRONG> mode, clicking button 1 on an element
- toggles its selection state without affecting any other elements.
- In <STRONG>extended</STRONG> mode, pressing button 1 on an element selects
- it, deselects everything else, and sets the anchor to the element
- under the mouse; dragging the mouse with button 1
- down extends the selection to include all the elements between
- the anchor and the element under the mouse, inclusive.</P>
- <P>Most people will probably want to use <STRONG>browse</STRONG> mode for
- single selections and <STRONG>extended</STRONG> mode for multiple selections;
- the other modes appear to be useful only in special situations.</P>
- <P>In addition to the above behavior, the following additional behavior
- is defined by the default bindings:</P>
- <DL>
- <DT><STRONG><A NAME="item_%5B1%5D">[1]</A></STRONG><BR>
- <DD>
- In <STRONG>extended</STRONG> mode, the selected range can be adjusted by pressing
- button 1 with the Shift key down: this modifies the selection to
- consist of the elements between the anchor and the element under
- the mouse, inclusive.
- The un-anchored end of this new selection can also be dragged with
- the button down.
- <P></P>
- <DT><STRONG><A NAME="item_%5B2%5D">[2]</A></STRONG><BR>
- <DD>
- In <STRONG>extended</STRONG> 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.
- 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
- all other elements remains what it was before the toggle operation
- began.
- <P></P>
- <DT><STRONG><A NAME="item_%5B3%5D">[3]</A></STRONG><BR>
- <DD>
- If the mouse leaves the listbox window with button 1 down, the window
- scrolls away from the mouse, making information visible that used
- to be off-screen on the side of the mouse.
- The scrolling continues until the mouse re-enters the window, the
- button is released, or the end of the listbox is reached.
- <P></P>
- <DT><STRONG><A NAME="item_%5B4%5D">[4]</A></STRONG><BR>
- <DD>
- Mouse button 2 may be used for scanning.
- If it is pressed and dragged over the listbox, the contents of
- the listbox drag at high speed in the direction the mouse moves.
- <P></P>
- <DT><STRONG><A NAME="item_%5B5%5D">[5]</A></STRONG><BR>
- <DD>
- If the Up or Down key is pressed, the location cursor (active
- element) moves up or down one element.
- If the selection mode is <STRONG>browse</STRONG> or <STRONG>extended</STRONG> then the
- new active element is also selected and all other elements are
- deselected.
- In <STRONG>extended</STRONG> mode the new active element becomes the
- selection anchor.
- <P></P>
- <DT><STRONG><A NAME="item_%5B6%5D">[6]</A></STRONG><BR>
- <DD>
- In <STRONG>extended</STRONG> mode, Shift-Up and Shift-Down move the location
- cursor (active element) up or down one element and also extend
- the selection to that element in a fashion similar to dragging
- with mouse button 1.
- <P></P>
- <DT><STRONG><A NAME="item_%5B7%5D">[7]</A></STRONG><BR>
- <DD>
- The Left and Right keys scroll the listbox view left and right
- by the width of the character <STRONG>0</STRONG>.
- Control-Left and Control-Right scroll the listbox view left and
- right by the width of the window.
- Control-Prior and Control-Next also scroll left and right by
- the width of the window.
- <P></P>
- <DT><STRONG><A NAME="item_%5B8%5D">[8]</A></STRONG><BR>
- <DD>
- The Prior and Next keys scroll the listbox view up and down
- by one page (the height of the window).
- <P></P>
- <DT><STRONG><A NAME="item_%5B9%5D">[9]</A></STRONG><BR>
- <DD>
- The Home and End keys scroll the listbox horizontally to
- the left and right edges, respectively.
- <P></P>
- <DT><STRONG><A NAME="item_%5B10%5D">[10]</A></STRONG><BR>
- <DD>
- Control-Home sets the location cursor to the the first element in
- the listbox, selects that element, and deselects everything else
- in the listbox.
- <P></P>
- <DT><STRONG><A NAME="item_%5B11%5D">[11]</A></STRONG><BR>
- <DD>
- Control-End sets the location cursor to the the last element in
- the listbox, selects that element, and deselects everything else
- in the listbox.
- <P></P>
- <DT><STRONG><A NAME="item_%5B12%5D">[12]</A></STRONG><BR>
- <DD>
- In <STRONG>extended</STRONG> mode, Control-Shift-Home extends the selection
- to the first element in the listbox and Control-Shift-End extends
- the selection to the last element.
- <P></P>
- <DT><STRONG><A NAME="item_%5B13%5D">[13]</A></STRONG><BR>
- <DD>
- In <STRONG>multiple</STRONG> mode, Control-Shift-Home moves the location cursor
- to the first element in the listbox and Control-Shift-End moves
- the location cursor to the last element.
- <P></P>
- <DT><STRONG><A NAME="item_%5B14%5D">[14]</A></STRONG><BR>
- <DD>
- The space and Select keys make a selection at the location cursor
- (active element) just as if mouse button 1 had been pressed over
- this element.
- <P></P>
- <DT><STRONG><A NAME="item_%5B15%5D">[15]</A></STRONG><BR>
- <DD>
- In <STRONG>extended</STRONG> mode, Control-Shift-space and Shift-Select
- extend the selection to the active element just as if button 1
- had been pressed with the Shift key down.
- <P></P>
- <DT><STRONG><A NAME="item_%5B16%5D">[16]</A></STRONG><BR>
- <DD>
- In <STRONG>extended</STRONG> mode, the Escape key cancels the most recent
- selection and restores all the elements in the selected range
- to their previous selection state.
- <P></P>
- <DT><STRONG><A NAME="item_%5B17%5D">[17]</A></STRONG><BR>
- <DD>
- Control-slash selects everything in the widget, except in
- <STRONG>single</STRONG> and <STRONG>browse</STRONG> modes, in which case it selects
- the active element and deselects everything else.
- <P></P>
- <DT><STRONG><A NAME="item_%5B18%5D">[18]</A></STRONG><BR>
- <DD>
- Control-backslash deselects everything in the widget, except in
- <STRONG>browse</STRONG> mode where it has no effect.
- <P></P>
- <DT><STRONG><A NAME="item_%5B19%5D">[19]</A></STRONG><BR>
- <DD>
- 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.
- <P>The behavior of listboxes can be changed by defining new bindings for
- individual widgets or by redefining the class bindings.</P>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>listbox, widget</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Listbox - Create and manipulate Listbox widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-