- NAME
- ListBox
- ListBox widget
- CREATION
- ListBox pathName ?option value...?
- STANDARD OPTIONS
- WIDGET-SPECIFIC OPTIONS
- WIDGET COMMAND
- pathName bindImage
event
script
- pathName bindText
event
script
- pathName cget
option
- pathName configure
?option? ?value option value ...?
- pathName delete
?arg...?
- pathName edit
node
?clickres?
- pathName exists
item
- pathName index
item
- pathName insert
index
item
?option value...?
- pathName item
first
?last?
- pathName itemcget
item
option
- pathName itemconfigure
item
?option? ?value option value ...?
- pathName items
- pathName move
item
index
- pathName see
item
- pathName selection
cmd
?arg...?
- pathName xview
?arg...?
- pathName yview
?arg...?
DESCRIPTION
ListBox 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
deltay option, so they must have at most this height.
A item is uniquely identified by a string given at creation (by the
insert command). The ListBox can have one or more columns, depending on
multicolumn 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.
WIDGET-SPECIFIC OPTIONS
- -deltax
-
Specifies horizontal pad between each columns.
- -deltay
-
Specifies vertical size of the items.
- -dragenabled
-
A boolean specifying if drag is enabled.
- -dragendcmd
-
Command associated when drag-end event occurs.
See DragSite::register for more informations.
- -dragevent
-
Event associated to the drag. Must be a <ButtonPress-x> event.
- -draginitcmd
-
Listbox has a command wrapper for drag-init events. This command refused the drag
if no item is designated. In other cases:
If draginitcmd is empty, it returns:
- the value of option dragtype or LISTBOX_ITEM if empty as the data type,
- {default move Control copy Alt link} as the operations,
- the item identifier as the data.
If draginitcmd is not empty, it is called with the following arguments:
- the pathname of the listbox,
- the identifier of the dragged item,
- the toplevel created to represent dragged data.
and must return a value conforming to draginitcmd option described in
DragSite::register.
- -dragtype
-
Specifies the type of the dragged data. Default is LISTBOX_ITEM
- -dropcmd
-
Listbox has a command wrapper for drop events. This command stops auto scrolling
and extract item and position.
If dropcmd is not empty, it is called with the same aguments as
dragovercmd command.
- -dropenabled
-
A boolean specifying if drop is enabled.
- -dropovercmd
-
- -droptypes
-
Specifies a list of accepted dropped object/operation. Default is empty.
- -height
-
Specifies the desired height for the listbox in units of deltay pixels.
- -multicolumn
-
Description text
- -padx
-
Specifies distance between image or window and text of the items.
- -redraw
-
Specifies wether or not the listbox should be redrawn when entering idle.
Set it to false if you call update while modifying the listbox.
- -width
-
Specifies the desired width for the listbox in units of 10 pixels.
WIDGET COMMAND
- pathName bindImage
event
script
-
This command associates a command to execute whenever the event
sequence given by event occurs on the image of a item.
The item idenfier on which the event occurs is appended to the command.
- pathName bindText
event
script
-
This command associates a command to execute whenever the event
sequence given by event occurs on the label of a item.
The item idenfier on which the event occurs is appended to the command.
- pathName cget
option
-
Returns the current value of the configuration option given by option.
Option may have any of the values accepted by the create command.
- pathName configure
?option? ?value option value ...?
-
Modify the configuration options of the widget.
Option may have any of the values accepted by the create command,
except those who are read-only.
- pathName delete
?arg...?
-
Deletes all items (and children of them) in arg.
To delete all the listbox, do eval Listbox::delete $listbox [Listbox::items $listbox root]
- pathName edit
node
?clickres?
-
Provides a way for the user to edit in place the label of a item. This is
possible only if item can be visible (all its parents are open).
The command does not modify the label of the edited item. The command returns an empty
string if edition is canceled, or the typed text if edition is accepted.
When editing, the user can cancel by pressing Escape, or accept by pressing Return.
clickres specifies what to do if the user click outside the editable area.
If clickres is 0 (the default), the edition is canceled.
If clickres is 1, the edition is accepted.
In all other case, the edition continues.
select specifies wether or not the initial text should be selected. Default is 1.
- pathName exists
item
-
Returns 1 if item exists in the listbox, else 0.
- pathName index
item
-
Returns the position of item in the list.
- pathName insert
index
item
?option value...?
-
Inserts a new item identified by item in the children list of parent
at position index.
- -data
-
User data associated to the item.
- -fill
-
Specifies the foreground color of the label of the item.
- -font
-
Specifies a font for the label of the item.
- -image
-
Specifies an image to display at the left of the label of the item.
window option override image.
- -indent
-
Description text
- -text
-
Specifies the label of the item.
- -window
-
Specifies a pathname to display at the left of the label of the item.
window option override image.
- pathName item
first
?last?
-
Description text
- pathName itemcget
item
option
-
Returns the current value of a configuration option for the item given by index.
Option may have any of the values accepted by the item creation command.
- pathName itemconfigure
item
?option? ?value option value ...?
-
Modify the configuration options of the item given by index. Options may have
any of the values accepted by the item creation command,
except those who are read-only.
- pathName items
-
Returns the list of all items.
- pathName move
item
index
-
Moves item at position index in the list.
- pathName see
item
-
Arrange the scrolling area to make item visible.
- pathName selection
cmd
?arg...?
-
Modifies the list of selected items following cmd:
- clear
- remove all items of the selection.
- set
- set the selection to all items in arg
- add
- add all items of arg in the selection
- remove
- remove all items of arg of the selection
- get
- return the current selected items
- pathName xview
?arg...?
-
Description text
- pathName yview
?arg...?
-
Description text