projman/hlp/en/bwidget/ListBox.html

609 lines
18 KiB
HTML
Raw Normal View History

2015-10-19 13:27:31 +03:00
<HTML>
<HEAD><TITLE>ListBox</TITLE></HEAD>
<BODY BGCOLOR=white>
<DL><DT><I><A HREF="#descr">NAME</A></I></DT>
<DD><B>ListBox</B>
- ListBox widget
</DD></DL>
<DL>
<DT><I>CREATION</I></DT>
<DD><A HREF="#descr"><B>ListBox</B></A> <I>pathName</I> ?<I>option value...</I>?</DD>
</DL>
<DL>
<DT><I>STANDARD OPTIONS</I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-background">-background or -bg</A></TD>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-borderwidth">-borderwidth or -bd</A></TD>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-cursor">-cursor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-highlightbackground">-highlightbackground</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-highlightcolor">-highlightcolor</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-highlightthickness">-highlightthickness</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectbackground">-selectbackground</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-selectforeground">-selectforeground</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-takefocus">-takefocus</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-xscrollcommand">-xscrollcommand</A></TR>
<TD>&nbsp;&nbsp;<A HREF="options.htm#M-yscrollcommand">-yscrollcommand</A></TR>
</TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wso">WIDGET-SPECIFIC OPTIONS</A></I></DT>
<DD><TABLE CELLSPACING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-deltax">-deltax</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-deltay">-deltay</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-dragenabled">-dragenabled</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-dragendcmd">-dragendcmd</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-dragevent">-dragevent</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-draginitcmd">-draginitcmd</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-dragtype">-dragtype</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-dropcmd">-dropcmd</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-dropenabled">-dropenabled</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-dropovercmd">-dropovercmd</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-dropovermode">-dropovermode</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-droptypes">-droptypes</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-height">-height</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-multicolumn">-multicolumn</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-padx">-padx</A></TR>
<TD>&nbsp;&nbsp;<A HREF="#-redraw">-redraw</A></TR>
</TR>
<TR>
<TD>&nbsp;&nbsp;<A HREF="#-width">-width</A></TR>
</TABLE></DD>
</DL>
<DL>
<DT><I><A HREF="#wc">WIDGET COMMAND</A></I></DT>
<DD><I>pathName</I> <A HREF="#bindImage"><B>bindImage</B></A>
<I>event</I>
<I>script</I>
</DD>
<DD><I>pathName</I> <A HREF="#bindText"><B>bindText</B></A>
<I>event</I>
<I>script</I>
</DD>
<DD><I>pathName</I> <A HREF="#cget"><B>cget</B></A>
<I>option</I>
</DD>
<DD><I>pathName</I> <A HREF="#configure"><B>configure</B></A>
?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD><I>pathName</I> <A HREF="#delete"><B>delete</B></A>
?<I>arg...</I>?
</DD>
<DD><I>pathName</I> <A HREF="#edit"><B>edit</B></A>
<I>item</I>
<I>text</I>
?<I>verifycmd</I>?
?<I>clickres</I>?
?<I>select</I>?
</DD>
<DD><I>pathName</I> <A HREF="#exists"><B>exists</B></A>
<I>item</I>
</DD>
<DD><I>pathName</I> <A HREF="#index"><B>index</B></A>
<I>item</I>
</DD>
<DD><I>pathName</I> <A HREF="#insert"><B>insert</B></A>
<I>index</I>
<I>item</I>
?<I>option value...</I>?
</DD>
<DD><I>pathName</I> <A HREF="#item"><B>item</B></A>
<I>first</I>
?<I>last</I>?
</DD>
<DD><I>pathName</I> <A HREF="#itemcget"><B>itemcget</B></A>
<I>item</I>
<I>option</I>
</DD>
<DD><I>pathName</I> <A HREF="#itemconfigure"><B>itemconfigure</B></A>
<I>item</I>
?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DD>
<DD><I>pathName</I> <A HREF="#items"><B>items</B></A>
?<I>first</I>?
?<I>last</I>?
</DD>
<DD><I>pathName</I> <A HREF="#move"><B>move</B></A>
<I>item</I>
<I>index</I>
</DD>
<DD><I>pathName</I> <A HREF="#reorder"><B>reorder</B></A>
<I>neworder</I>
</DD>
<DD><I>pathName</I> <A HREF="#see"><B>see</B></A>
<I>item</I>
</DD>
<DD><I>pathName</I> <A HREF="#selection"><B>selection</B></A>
<I>cmd</I>
?<I>arg...</I>?
</DD>
<DD><I>pathName</I> <A HREF="#xview"><B>xview</B></A>
?<I>arg...</I>?
</DD>
<DD><I>pathName</I> <A HREF="#yview"><B>yview</B></A>
?<I>arg...</I>?
</DD>
</DL>
<BR><HR WIDTH="100%"><BR>
<B><A NAME="descr"></A>DESCRIPTION</B><BR>
<P>
<B>ListBox</B> widget uses canvas to display a list of items.
Each item is composed of a label with its own font and foreground attributes, and an optional
image or window. Each item is drawn in a single line, whose height is defined by the
<B>deltay</B> option, so they must have at most this height.
A item is uniquely identified by a string given at creation (by the
<B>insert</B> command). The ListBox can have one or more columns, depending on
<B>multicolumn</B> option. The user do not handle columns; the number of columns
is determined following the height of the ListBox in order to see each item vertically.
</P>
<BR><HR WIDTH="50%"><BR>
<B><A NAME="wso">WIDGET-SPECIFIC OPTIONS</A></B><BR>
<DL><DT><A NAME="-deltax"><B>-deltax</B></A></DT>
<DD>
Specifies horizontal pad between each columns.
</DD>
</DL>
<DL><DT><A NAME="-deltay"><B>-deltay</B></A></DT>
<DD>
Specifies vertical size of the items.
</DD>
</DL>
<DL><DT><A NAME="-dragenabled"><B>-dragenabled</B></A></DT>
<DD>
A boolean specifying if drag is enabled.
</DD>
</DL>
<DL><DT><A NAME="-dragendcmd"><B>-dragendcmd</B></A></DT>
<DD>
Specifies a command to be called when drag ended.
<B>dragendcmd</B> must be a command conforming to the description of the
option <B>dragendcmd</B> of <B>DragSite::<A HREF="DragSite.html#register">register</A></B>.
</DD>
</DL>
<DL><DT><A NAME="-dragevent"><B>-dragevent</B></A></DT>
<DD>
Specifies the number of the mouse button associated to the drag.
Must be <B>1</B>, <B>2</B> or <B>3</B>.
</DD>
</DL>
<DL><DT><A NAME="-draginitcmd"><B>-draginitcmd</B></A></DT>
<DD>
ListBox has a command wrapper for <I>drag-init</I> events. This command refused the drag
if no item is designated. In other cases:
<BR>If <B>draginitcmd</B> is empty, it returns:
<UL>
<LI>the value of option <B>dragtype</B> or <I>LISTBOX_ITEM</I> if empty as the data type,
<LI><I>{move copy link}</I> as the operations,
<LI>the item identifier as the data.
</UL>
If <B>draginitcmd</B> is not empty, it is called with the following arguments:
<UL>
<LI>the pathname of the listbox,
<LI>the identifier of the dragged item,
<LI>the toplevel created to represent dragged data.
</UL>
and must return a value conforming to <B>draginitcmd</B> option described in
<B>DragSite::<A HREF="DragSite.html#register">register</A></B>.
</DD>
</DL>
<DL><DT><A NAME="-dragtype"><B>-dragtype</B></A></DT>
<DD>
Specifies an alternate type of dragged object.
</DD>
</DL>
<DL><DT><A NAME="-dropcmd"><B>-dropcmd</B></A></DT>
<DD>
ListBox has a command wrapper for <I>drop</I> events. This command stops auto scrolling
and extract item and position.
<BR>If <B>dropcmd</B> is not empty, it is called with the following arguments:
<UL>
<LI>the pathname of the listbox,
<LI>the pathname of the drag source,
<LI>a list describing where the drop occurs. It can be:
<UL>
<LI><I>{</I><B>widget</B><I>}</I>,
<LI><I>{</I><B>item</B> <I>item}</I> or
<LI><I>{</I><B>position</B> <I>index}</I>.
</UL>
<LI>the current operation,
<LI>the data type,
<LI>the data.
</UL>
</DD>
</DL>
<DL><DT><A NAME="-dropenabled"><B>-dropenabled</B></A></DT>
<DD>
A boolean specifying if drop is enabled.
</DD>
</DL>
<DL><DT><A NAME="-dropovercmd"><B>-dropovercmd</B></A></DT>
<DD>
LsitBox has a command wrapper for <I>drag-over</I> events. This command enables auto scrolling
and position extraction during the <I>drag-over</I>.
If <B>dropovercmd</B> is not empty, the command is called with the following aguments:
<UL>
<LI>the pathname of the listbox,
<LI>the pathname of the drag source,
<LI>a list describing where the drop can occur, whose elements are:
<UL>
<LI>the string <I>widget</I> if <B>dropovertype</B> option contains <I>w</I>, else empty string.
<LI>the targeted item if drag icon points an item and <B>dropovertype</B> option contains
<I>i</I>, else empty string.
<LI>an index within two items where drag icon points to if <B>dropovertype</B> option
contains <I>p</I>, else empty string.
<LI>optionally, the preferred method if drop can occur both inside an item and between two
items. The value is <I>position</I> or <I>item</I>.
</UL>
<LI>the current operation,
<LI>the data type,
<LI>the data.
</UL>
The command must return a list with two elements:
<UL>
<LI>the drop status, conforming to those described in <B>dropovercmd</B> option of
<B>DropSite::<A HREF="DropSite.html#register">register</A></B>,
<LI>the choosen method: <I>widget</I>, <I>item</I> or <I>position</I>.
</UL>
</DD>
</DL>
<DL><DT><A NAME="-dropovermode"><B>-dropovermode</B></A></DT>
<DD>
Specifies the type of <I>drop-over</I> interaction. Must be a combination of
<B>w</B>, which specifies that drop can occurs everywhere on widget,
<B>p</B>, which specifies that drop can occurs between two items,
and <B>i</B>, which specifies that drop occurs inside items.
</DD>
</DL>
<DL><DT><A NAME="-droptypes"><B>-droptypes</B></A></DT>
<DD>
Specifies a list of accepted dropped object/operation.
See option <B>droptypes</B> of
<B>DropSite::<A HREF="DropSite.html#register">register</A></B>.
for more infromation.
<BR>Default is <I>LISTBOX_ITEM</I> with operations <B>copy</B> and <B>move</B>.
</DD>
</DL>
<DL><DT><A NAME="-height"><B>-height</B></A></DT>
<DD>
Specifies the desired height for the listbox in units of <B>deltay</B> pixels.
</DD>
</DL>
<DL><DT><A NAME="-multicolumn"><B>-multicolumn</B></A></DT>
<DD>
Specifies wether or not ListBox layouts items in order to see each one vertically.
</DD>
</DL>
<DL><DT><A NAME="-padx"><B>-padx</B></A></DT>
<DD>
Specifies distance between image or window and text of the items.
</DD>
</DL>
<DL><DT><A NAME="-redraw"><B>-redraw</B></A></DT>
<DD>
Specifies wether or not the listbox should be redrawn when entering idle.
Set it to false if you call <B>update</B> while modifying the listbox.
</DD>
</DL>
<DL><DT><A NAME="-width"><B>-width</B></A></DT>
<DD>
Specifies the desired width for the listbox in units of 8 pixels.
</DD>
</DL>
<HR WIDTH="50%"><BR>
<B><A NAME="wc">WIDGET COMMAND</A></B><BR>
<DL><DT><A NAME="bindImage"><I>pathName</I> <B>bindImage</B></A>
<I>event</I>
<I>script</I>
</DT><DD>
This command associates a command to execute whenever the event
sequence given by <I>event</I> occurs on the image of a item.
The item idenfier on which the event occurs is appended to the command.
</DD></DL>
<DL><DT><A NAME="bindText"><I>pathName</I> <B>bindText</B></A>
<I>event</I>
<I>script</I>
</DT><DD>
This command associates a command to execute whenever the event
sequence given by <I>event</I> occurs on the label of a item.
The item idenfier on which the event occurs is appended to the command.
</DD></DL>
<DL><DT><A NAME="cget"><I>pathName</I> <B>cget</B></A>
<I>option</I>
</DT><DD>
Returns the current value of the configuration option given by <I>option</I>.
<I>Option</I> may have any of the values accepted by the creation command.
</DD></DL>
<DL><DT><A NAME="configure"><I>pathName</I> <B>configure</B></A>
?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DT><DD>
Query or modify the configuration options of the widget. If no <I>option</I> is specified,
returns a list describing all of the available options for <I>pathName</I>.
If <I>option</I> is specified with no <I>value</I>, then the command returns a list
describing the one named <I>option</I> (this list will be identical to the corresponding
sublist of the value returned if no <I>option</I> is specified). If one or
more <I>option-value</I> pairs are specified, then the command modifies the given widget
option(s) to have the given value(s); in this case the command returns an empty string.
<I>Option</I> may have any of the values accepted by the creation command.
Read-only options are not be modified.
</DD></DL>
<DL><DT><A NAME="delete"><I>pathName</I> <B>delete</B></A>
?<I>arg...</I>?
</DT><DD>
Deletes all items in <I>arg</I>. <I>arg</I> can be a list
of items or a list of list of items.
To delete all items, do <I>$pathName delete [$pathName items]</I>.
</DD></DL>
<DL><DT><A NAME="edit"><I>pathName</I> <B>edit</B></A>
<I>item</I>
<I>text</I>
?<I>verifycmd</I>?
?<I>clickres</I>?
?<I>select</I>?
</DT><DD>
Provides a way for the user to edit in place the label of an item.
<BR>The command takes the initial text as argument and does not modify the label of the
edited node, but returns an empty string if edition is canceled, or the typed text
if edition is accepted.
<BR>When editing, the user can cancel by pressing Escape, or accept by pressing Return.
<BR><I>clickres</I> specifies what to do if the user click outside the editable area.
If <I>clickres</I> is 0 (the default), the edition is canceled.
If <I>clickres</I> is 1, the edition is accepted.
In all other case, the edition continues.
<BR>If edition is accepted and <I>modifycmd</I> is not empty, then it is called with
the new text as argument and must return 1 to accept the new text, 0 to refuse it
and continue edition.
<BR><I>select</I> specifies wether or not the initial text should be selected. Default is 1.
</DD></DL>
<DL><DT><A NAME="exists"><I>pathName</I> <B>exists</B></A>
<I>item</I>
</DT><DD>
Returns 1 if <I>item</I> exists in the listbox, else 0.
</DD></DL>
<DL><DT><A NAME="index"><I>pathName</I> <B>index</B></A>
<I>item</I>
</DT><DD>
Returns the position of <I>item</I> in the list.
</DD></DL>
<DL><DT><A NAME="insert"><I>pathName</I> <B>insert</B></A>
<I>index</I>
<I>item</I>
?<I>option value...</I>?
</DT><DD>
Inserts a new item identified by <I>item</I> in the list at position <I>index</I>.
<P>
<DL><DT><A NAME="Item-data"><B>-data</B></A></DT>
<DD>
User data associated to the item.
</DD>
</DL>
<DL><DT><A NAME="Item-fill"><B>-fill</B></A></DT>
<DD>
Specifies the foreground color of the label of the item.
</DD>
</DL>
<DL><DT><A NAME="Item-font"><B>-font</B></A></DT>
<DD>
Specifies a font for the label of the item.
</DD>
</DL>
<DL><DT><A NAME="Item-image"><B>-image</B></A></DT>
<DD>
Specifies an image to display at the left of the label of the item.
<B>window</B> option override <B>image</B>.
</DD>
</DL>
<DL><DT><A NAME="Item-indent"><B>-indent</B></A></DT>
<DD>
Specifies the amount of extra space in pixels at the left of the item.
</DD>
</DL>
<DL><DT><A NAME="Item-text"><B>-text</B></A></DT>
<DD>
Specifies the label of the item.
</DD>
</DL>
<DL><DT><A NAME="Item-window"><B>-window</B></A></DT>
<DD>
Specifies a pathname to display at the left of the label of the item.
<B>window</B> option override <B>image</B>.
</DD>
</DL>
</DD></DL>
<DL><DT><A NAME="item"><I>pathName</I> <B>item</B></A>
<I>first</I>
?<I>last</I>?
</DT><DD>
<B>Its use is deprecated. Use <I>items</I> instead.</B><BR>
If <I>last</I> is omitted, returns the item at index <I>first</I> in the list,
or an empty string if <I>first</I> refers to a non-existent element.
If <I>last</I> is specified, the command returns a list whose elements are all
of the items between <I>first</I> and <I>last</I>, inclusive.
Both <I>first</I> and <I>last</I> may have any of the standard forms for indices.
</DD></DL>
<DL><DT><A NAME="itemcget"><I>pathName</I> <B>itemcget</B></A>
<I>item</I>
<I>option</I>
</DT><DD>
Returns the current value of a configuration option for the item.
<I>Option</I> may have any of the values accepted by the item creation command.
</DD></DL>
<DL><DT><A NAME="itemconfigure"><I>pathName</I> <B>itemconfigure</B></A>
<I>item</I>
?<I>option</I>? ?<I>value</I> <I>option</I> <I>value</I> ...?
</DT><DD>
This command is similar to the <B>configure</B> command, except that it applies to the
options for an individual item, whereas <B>configure</B> applies to the options for
the widget as a whole. <B>Options</B> may have any of the values accepted by the
item creation widget command. If options are specified, options are modified as indicated
in the command and the command returns an empty string. If no options are specified,
returns a list describing the current options for the item.
Read-only options are not be modified.
</DD></DL>
<DL><DT><A NAME="items"><I>pathName</I> <B>items</B></A>
?<I>first</I>?
?<I>last</I>?
</DT><DD>
If <I>first</I> and <I>last</I> are omitted, returns the list of all items.
If <I>first</I> is specified and <I>last</I> omitted, returns the item at index
<I>first</I>, or an empty string if <I>first</I> refers to a non-existent element.
If <I>first</I> and <I>last</I> are specified, the command returns a list whose elements
are all of the items between <I>first</I> and <I>last</I>,
inclusive. Both <I>first</I> and <I>last</I> may have any of the standard
forms for indices.
</DD></DL>
<DL><DT><A NAME="move"><I>pathName</I> <B>move</B></A>
<I>item</I>
<I>index</I>
</DT><DD>
Moves <I>item</I> at position <I>index</I> in the list.
</DD></DL>
<DL><DT><A NAME="reorder"><I>pathName</I> <B>reorder</B></A>
<I>neworder</I>
</DT><DD>
Modifies the order of items in the listbox given by <I>neworder</I>. Items that do not
appear in <I>neworder</I> are no moved.
</DD></DL>
<DL><DT><A NAME="see"><I>pathName</I> <B>see</B></A>
<I>item</I>
</DT><DD>
Arrange the scrolling area to make <I>item</I> visible.
</DD></DL>
<DL><DT><A NAME="selection"><I>pathName</I> <B>selection</B></A>
<I>cmd</I>
?<I>arg...</I>?
</DT><DD>
Modifies the list of selected items following <I>cmd</I>:
<DL>
<DT><B>clear</B>
<DD>remove all items of the selection.
<DT><B>set</B>
<DD>set the selection to all items in <I>arg</I>
<DT><B>add</B>
<DD>add all items of <I>arg</I> in the selection
<DT><B>remove</B>
<DD>remove all items of <I>arg</I> of the selection
<DT><B>get</B>
<DD>return the current selected items
</DL>
</DD></DL>
<DL><DT><A NAME="xview"><I>pathName</I> <B>xview</B></A>
?<I>arg...</I>?
</DT><DD>
Standard command to enable horizontal scrolling of <I>pathName</I>.
</DD></DL>
<DL><DT><A NAME="yview"><I>pathName</I> <B>yview</B></A>
?<I>arg...</I>?
</DT><DD>
Standard command to enable vertical scrolling of <I>pathName</I>.
</DD></DL>
</BODY></HTML>