tixHList - Create and manipulate Tix Hierarchial List widgets
SYNOPSIS
tixHList pathName ?options?
SUPER-CLASS
None.
STANDARD OPTIONS
background borderWidth cursor foreground
font height highlightColor highlightThickness
relief selectBackground selectForeground
xScrollCommand yScrollCommand width
WIDGET-SPECIFIC OPTIONS
Name: browsecmd
Class: BrowseCmd
Switch: -browsecmd
Specifies a TCL command to be executed when the user browses through the
entries in the HList widget.
Name: command
Class: Command
Switch: -command
Specifies the TCL command to be executed when the user invokes a list
entry in the HList widget. Normally the user invokes a list
entry by double-clicking it or pressing the Return key.
Name: drawBranch
Class: DrawBranch
Switch: -drawbranch
A Boolean value to specify whether branch line should be drawn to
connect list entries to their parents.
Name: foreground
Class: Foreground
Switch: -foreground
Alias: -fg
[OBSOLETE] Specifies the default foreground color for the list entries.
Name: gap
Class: Gap
Switch: -gap
[OBSOLETE] The default distance between the bitmap/image and the
text in list entries.
Name: height
Class: Height
Switch: -height
Specifies the desired height for the window in characters.
Name: indent
Class: Indent
Switch: -indent
Specifies the amount of horizontal indentation between a list entry
and its children. Must be a valid screen distance value.
Name: itemType
Class: ItemType
Switch: -itemtype
Specifies the default type of display item for this HList widget. When
you call the add and addchild widget commands, display items of this
type will be created if the -itemtype option is not specified .
Name: padX
Class: Pad
Switch: -padx
[OBSOLETE] The default horizontal padding for list entries.
Name: padY
Class: Pad
Switch: -padx
[OBSOLETE] The default vertical padding for list entries.
Name: selectBackground
Class: SelectBackground
Switch: -selectbackground
Specifies the background color for the selected list entries.
Name: selectBorderWidth
Class: BorderWidth
Switch: -selectborderwidth
Specifies a non-negative value indicating the width of the 3-D border
to draw around selected items. The value may have any of the forms
acceptable to Tk_GetPixels.
Name: selectForeground
Class: SelectForeground
Switch: -selectforeground
Specifies the foreground color for the selected list entries.
Name: selectMode
Class: SelectMode
Switch: -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 single.
Name: sizeCmd
Class: SizeCmd
Switch: -sizecmd
Specifies a TCL script to be called whenever the tixHList widget
changes its size. This command can be useful to implement "user scroll
bars when needed" features.
Name: separator
Class: Separator
Switch: -separator
Specifies the character to used as the separator character when
intepreting the path-names of list entries. By default the character
"." is used.
Name: width
Class: Width
Switch: -width
Specifies the desired width for the window in characters.
DESCRIPTION
The tixHList command creates a new window (given by the
pathName argument) and makes it into a HList widget.
Additional options, described above, may be specified on the command
line or in the option database to configure aspects of the
HList widget such as its cursor and relief.
The HList widget can be used to display any data that have a
hierarchical structure, for example, file system directory trees. The
list entries are indented and connected by branch lines according to
their places in the hierachy.
Each list entry is identified by a entryPath. The entryPath is a
sequence of entry names separated by the separator charactor
(specified by the -separator option). An entry name can be
any string that does not contain the separator charactor, or it can be
the a string that contains only one separator charactor.
For example, when "." is used as the separator charactor,
"one.two.three" is the entryPath for a list entry whose parent is
"one.two", whose parent is "one", which is a toplevel entry (has no
parents).
Another examples: ".two.three" is the entryPath for a list entry whose
parent is ".two", whose parent is ".", which is a toplevel entry.
DISPLAY ITEMS
Each list entry in an HList widget is associated with a display
item. The display item determines what visual information should
be displayed for this list entry. Please see the DItem(n) manual
page for a list of all display items.
When a list entry is created by the add or addchild widget
commands, the type of its display item is determined by the
-itemtype option passed to these commands. If the
-itemtype is omitted, then by default the display item type
text is used.
WIDGET COMMAND
The tixHList command creates a new Tcl command whose name is the
may be used to invoke various operations on the widget. It has the
following general form:
pathName option ?arg arg ...?
PathName is the name of the command, which is the same as
determine the exact behavior of the command. The following
commands are possible for HList widgets:
- pathName add entryPath ?option value ...?
- Creates a new list entry with the pathname entryPath. A list
entry must be created after its parent is created (unless this entry
is a top-level entry, which has no parent). This command returns the
entryPath of the newly created list entry. The following
configuration options can be given to configure the list entry:
- -at position
- Insert the new list at the position given by position.
position must be a valid integer. the Position 0 indicates
the first position, 1 indicates the second position, and so on.
- -after afterWhich
- Insert the new list entry after the entry identified by
afterWhich. afterWhich must be a valid list entry and it
mush have the same parent as the new list entry
- -before beforeWhich
- Insert the new list entry before the entry identified by
beforeWhich. beforeWhich must be a valid list entry and it
mush have the same parent as the new list entry
- -data string
- Specifies a string to associate with this list entry. This string can
be queried by the info widget command. The application
programmer can use the -data option to associate the list entry
with the data it represents.
- -itemtype type
- Specifies the type of display item to be display for the new list
entry. type must be a valid display item type. Currently the
available display item types are imagetext, text, and
window. If this option is not specified, then by default the
display item type specified by the -itemtype widget option is
created.
- -state
- Specifies whether this entry can be selected or invoked by the user.
Must be either normal or disabled.
The add widget command accepts additional configuration options
to configure the display item associated with this list entry. The set
of additional configuration options depends on the type of the display
item given by the -itemtype option. Please see the DItem(n)
manual page for a list of the configuration options for each of the
display item types.
- pathName addchild parentPath ?option value ... ?
- Adds a new child entry to the children list of the list entry
identified by parentPath. Or, if parentPath is set to be
the empty string, then creates a new toplevel entry. The name of the
new list entry will be a unique name automatically generated by the
HList widget. Usually if parentPath is foo, then the
entryPath of the new entry will be foo.1, foo.2, ... etc.
This command returns the entryPath of the newly created list entry.
option can be any option for the add widget command.
- pathName anchor set entryPath
- Sets the anchor to the list entry identified by
entryPath. The anchor is the end of the selection
that is fixed while dragging out a selection with the mouse.
- pathName anchor clear
- Remove the anchor, if any, from the this tixHList widget. This only
removes the surrounding highlights of the anchor entry and does not
affect its selection status.
- pathName cget option
- Returns the current value of the configuration option given by
option. Option may have any of the values accepted by the
tixHList command.
- pathName configure ?option? ?value option value ...?
- Query or modify the configuration options of the widget. If no
option is specified, returns a list describing all of the
available options for pathName (see Tk_ConfigureInfo for
information on the format of this list). If option is specified
with no value, then the command returns a list describing the
one named option (this list will be identical to the corresponding
sublist of the value returned if no option is specified). If
one or more option-value 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. Option may have
any of the values accepted by the tixHList command.
- pathName delete option entryPath
- Delete one or more list entries. option may be one of the
following:
- all
- Delete all entries in the tixHList. In this case the entryPath
does not need to be specified.
- entry
- Delete the entry specified by entryPath. and all its offsprings,
if any.
- offsprings
- Delete all the offsprings, if any, of the entry specified by
entryPath. However, entryPath itself is not deleted.
- siblings
- Delete all the list entries that share the same parent with the entry
specified by entryPath. However, entryPath itself is not
deleted.
- pathName entrycget entryPath option
- Returns the current value of the configuration option given by
option for the entry indentfied by entryPath. Option
may have any of the values accepted by the tixHList add
command.
- pathName entryconfigure entryPath ?option? ?value option value ...?
- Query or modify the configuration options of the list entry indentfied
by entryPath. If no option is specified, returns a list
describing all of the available options for entryPath (see
Tk_ConfigureInfo for information on the format of this list). If
option is specified with no value, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
option is specified). If one or more option-value pairs
are specified, then the command modifies the given option(s) to have
the given value(s); in this case the command returns an empty string.
Option may have any of the values accepted by the add or
addchild widget command. The exact set of options depends on the
value of the -itemtype option passed to the the add or
addchild widget command when this list entry is created.
- pathName dropsite set entryPath
- Sets the dropsite to the list entry identified by
entryPath. The dropsite is used to indicate the target of a
grag-and-drop action. Currently drag-and-drop functionality has not
been implemented in Tix yet.
- pathName dropsite clear
- Remove the dropsite, if any, from the this tixHList widget. This only
removes the surrounding highlights of the dropsite entry and does not
affect its selection status.
- pathName hide option ?entryPath?
- Makes some of entries invisible invisible without deleting them.
option can be one of the following:
- pathName info option arg ...
- Query information about the tixHList widget. option can be one
of the following:
- pathName info anchor entryPath
- Returns the entryPath of the current anchor, if any, of the HList
widget. If the anchor is not set, returns the empty string.
- pathName info dropsite entryPath
- Returns the entryPath of the current dropsite, if any, of the HList
widget. If the dropsite is not set, returns the empty string.
- pathName info children ?entryPath?
- children entries. Otherwise returns a list of the toplevel
- pathName info exists entryPath
- Returns a boolean value indicating whether the list entry
entrpyPath exists.
- pathName info hidden entryPath
- Returns a boolean value indicating whether the list entry
entrpyPath is hidden or not.
- pathName info next entryPath
- Returns the entryPath of the list entry, if any, immediately below
this list entry. If this entry is already at the bottom of the HList
widget, returns an empty string.
- pathName info parent entryPath
- Returns the name of the parent of the list entry indified by
entrpyPath. If entrpyPath is a toplevel list entry,
returns the empty string.
- pathName info prev entryPath
- Returns the entryPath of the list entry, if any, immediately above
this list entry. If this entry is already at the top of the HList
widget, returns an empty string.
- pathName info selection
- Returns a list of selected elements in the HList widget. If no entries
are selectd, returns an empty string.
- pathName nearest y
- Given a y-coordinate within the tixHList window, this command returns
the entryPath of the (visible) tixHList element nearest to that
y-coordinate.
- pathName see entryPath
- Adjust the view in the tixHList so that the element given by index 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 tixHList
scrolls to bring the element into view at the edge; otherwise the
tixHList scrolls to center the element.
- pathName selection option arg ...
- This command is used to adjust the selection within a tixHList widget. It
has several forms, depending on option:
- pathName selection clear ?from? ?to?
- When no extra arguments are given, deselects all of the list entrie(s)
in this tixHList widget. When only from is given, only the list
entry identified by from is deselected. When both from and
to are given, deselects all of the list entrie(s) between
between from and to, inclusive, without affecting the
selection state of elements outside that range.
- pathName selection includes entryPath
- Returns 1 if the list entry indicated by entryPath is currently
- pathName selection set from ?to?
- Selects all of the list entrie(s) between between from and
to, inclusive, without affecting the selection state of elements
outside that range. When only from is given, only the list entry
identified by from is selected.
- pathName show option ?entryPath?
- Show the entries that are hidden by the hide command,
option can be one of the following:
- pathName xview args
- This command is used to query and change the horizontal position of the
forms:
- pathName xview
- 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
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 -xscrollcommand option.
- pathName xview entryPath
- Adjusts the view in the window so that the list entry identified by
entryPath is aligned to the left edge of the window.
- pathName xview moveto fraction
- Adjusts the view in the window so that fraction of the total
width of the HList is off-screen to the left. fraction must be
a fraction between 0 and 1.
- pathName xview scroll number what
- This command shifts the view in the window left or right according to
number and what. Number must be an integer.
What must be either units or pages or an
abbreviation of one of these. If what is units, the view
adjusts left or right by number character units (the width of
the 0 character) on the display; if it is pages then the
view adjusts by number screenfuls. If number is negative
then characters farther to the left become visible; if it is positive
then characters farther to the right become visible.
- pathName yview ?args?
- This command is used to query and change the vertical position of the
It can take any of the following forms:
- pathName yview
- Returns a list containing two elements, both of which are real
fractions between 0 and 1. The first element gives the position of
the list element at the top of the window, relative to the HList
as a whole (0.5 means it is halfway through the HList, for example).
The second element gives the position of the list entry just
after the last one in the window, relative to the HList as a whole.
These are the same values passed to scrollbars via the
-yscrollcommand option.
- pathName yview entryPath
- Adjusts the view in the window so that the list entry given by
entryPath is displayed at the top of the window.
- pathName yview moveto fraction
- Adjusts the view in the window so that the list entry given by
fraction appears at the top of the window. Fraction is a
fraction between 0 and 1; 0 indicates the first element in the
HList, 0.33 indicates the element one-third the way through the
HList, and so on.
- pathName yview scroll number what
- This command adjust the view in the window up or down according to
number and what. Number must be an integer.
What must be either units or pages. If what
is units, the view adjusts up or down by number lines; if
it is pages then the view adjusts by number screenfuls.
If number is negative then earlier elements become visible; if
it is positive then later elements become visible.
BINDINGS
[1]
If the -selectmode is "browse", when the user drags the mouse
pointer over the list entries, the entry under the pointer will be
highlighted and the -browsecmd procedure will be called with
one parameter, the entryPath of the highlighted entry. Only one entry
can be highlighted at a time. The -command procedure will be
called when the user double-clicks on a list entry.
[2]
If the -selectmode is "single", the entries will only be
highlighted by mouse <ButtonRelease-1> events. When a new list entry
is highlighted, the -browsecmd procedure will be called with
one parameter indicating the highlighted list entry. The
-command procedure will be called when the user double-clicks
on a list entry.
[3]
If the -selectmode is "multiple", when the user drags the mouse
pointer over the list entries, all the entries under the pointer will
be highlighted. However, only a contiguous region of list entries can
be selected. When the highlighted area is changed, the
-browsecmd procedure will be called with an undefined
parameter. It is the responsibility of the -browsecmd procedure
to find out the exact highlighted selection in the HList.
[4]
If the -selectmode is "extended", when the user drags the mouse
pointer over the list entries, all the entries under the pointer will
be highlighted. The user can also make disjointed selections using
<Control-ButtonPress-1>. When the highlighted area is changed, the
-browsecmd procedure will be called with an undefined
parameter. It is the responsibility of the -browsecmd procedure
to find out the exact highlighted selection in the HList.
[5]
Arrow key bindings: <Up> arrow key moves the anchor point to the
item right on top of the current anchor item. <Down> arrow key moves
the anchor point to the item right below the current anchor item.
<Left> arrow key moves the anchor to the parent item of the current
anchor item. <Right> moves the anchor to the first child of the
current anchor item. If the current anchor item does not have any
children, moves the anchor to the item right below the current anchor
item.
EXAMPLE
This example demonstrates how to use an HList to store a file
tixHList .h -separator "/" -browsecmd browse -selectmode single
.h add / -text /
.h add /home -text /home
.h add /home/ioi -text /home/ioi
.h add /home/foo -text /home/foo
.h add /usr -text /usr
.h add /usr/lib -text /usr/lib
pack .h
proc browse {file} {
puts "$file browsed"
}
KEYWORDS
Tix(n), hierarchical listbox
Last modified Jul 23 20:01 ---
Serial 806544114