| 1 |
'\" |
| 2 |
'\" Copyright 2001-2 by Silicon Metrics Corporation. |
| 3 |
'\" |
| 4 |
'\" Permission to use, copy, modify, and distribute this software and its |
| 5 |
'\" documentation for any purpose and without fee is hereby granted, provided |
| 6 |
'\" that the above copyright notice appear in all copies and that both that the |
| 7 |
'\" copyright notice and warranty disclaimer appear in supporting documentation, |
| 8 |
'\" and that the names of Silicon Metrics or any of their entities not be used |
| 9 |
'\" in advertising or publicity pertaining to distribution of the software |
| 10 |
'\" without specific, written prior permission. |
| 11 |
'\" |
| 12 |
'\" Silicon Metrics disclaims all warranties with regard to this software, |
| 13 |
'\" including all implied warranties of merchantability and fitness. In no event |
| 14 |
'\" shall Silicon Metrics be liable for any special, indirect or |
| 15 |
'\" consequential damages or any damages whatsoever resulting from loss of use, |
| 16 |
'\" data or profits, whether in an action of contract, negligence or other |
| 17 |
'\" tortuous action, arising out of or in connection with the use or performance |
| 18 |
'\" of this software. |
| 19 |
'\" |
| 20 |
'\" The hierarchical table widget created by George Howlett. |
| 21 |
'\" |
| 22 |
.so man.macros |
| 23 |
.TH treeview n BLT_VERSION BLT "BLT Built-In Commands" |
| 24 |
.BS |
| 25 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 26 |
.SH NAME |
| 27 |
treeview \- Create and manipulate hierarchical table widgets |
| 28 |
.BE |
| 29 |
.SH SYNOPSIS |
| 30 |
\fBtreeview\fR \fIpathName \fR?\fIoptions\fR? |
| 31 |
.SH DESCRIPTION |
| 32 |
The \fBtreeview\fR widget displays a tree of data. It replaces both |
| 33 |
the \fBhiertable\fR and \fBhierbox\fR widgets. The \fBtreeview\fR is |
| 34 |
100% syntax compatible with the \fBhiertable\fR widget. The |
| 35 |
\fBhiertable\fR command is retained for sake of script-level |
| 36 |
compatibility. This widget obsoletes the \fBhierbox\fR widget. It |
| 37 |
does everything the old \fBhierbox\fR widget did, but also provides |
| 38 |
data sharing (via \fItree data objects\fR) and the ability to tag |
| 39 |
nodes. |
| 40 |
.SH INTRODUCTION |
| 41 |
The \fBtreeview\fR widget displays hierarchical data. Data is |
| 42 |
represented as nodes in a general-ordered tree. Each node may have |
| 43 |
sub-nodes and these nodes can in turn has their own children. |
| 44 |
.PP |
| 45 |
A node is displayed as a row entry in the widget. Each entry has a |
| 46 |
text label and icon. When a node has children, its entry is drawn |
| 47 |
with a small button to the left of the label. Clicking the mouse over |
| 48 |
this button opens or closes the node. When a node is \fIopen\fR, its |
| 49 |
children are exposed. When it is \fIclosed\fR, the children and their |
| 50 |
descedants are hidden. The button is normally a \fB+\fR or |
| 51 |
\fB\-\fR symbol (ala Windows Explorer), but can be replaced with a |
| 52 |
pair of Tk images (open and closed images). |
| 53 |
.PP |
| 54 |
If the node has data associated with it, they can be displayed in |
| 55 |
columns running vertically on either side the tree. You can control |
| 56 |
the color, font, etc of each entry. Any entry label or data field can |
| 57 |
be edited in-place. |
| 58 |
.SH "TREE DATA OBJECT" |
| 59 |
The tree is not stored inside the widget but in a tree data object |
| 60 |
(see the \fBtree\fR command for a further explanation). Tree data |
| 61 |
objects can be shared among different clients, such as a |
| 62 |
\fBtreeview\fR widget or the \fBtree\fR command. You can walk the |
| 63 |
tree and manage its data with the \fBtree\fR command tree, while |
| 64 |
displaying it with the \fBtreeview\fR widget. Whenever the tree is |
| 65 |
updated, the \fBtreeview\fR widget is automatically redrawn. |
| 66 |
.PP |
| 67 |
By default, the \fBtreeview\fR widget creates its own tree object. |
| 68 |
The tree initially contains just a root node. But you can also |
| 69 |
display trees created by the \fBtree\fR command using the \fB\-tree\fR |
| 70 |
configuration option. \fBTreeview\fR widgets can share the same tree |
| 71 |
object, possibly displaying different views of the same data. |
| 72 |
.PP |
| 73 |
A tree object has both a Tcl and C API. You can insert or delete |
| 74 |
nodes using \fBtreeview\fR widget or \fBtree\fR command operations, |
| 75 |
but also from C code. For example, you can load the tree from your C |
| 76 |
code while still managing and displaying the tree from Tcl. The widget |
| 77 |
is automatically notified whenever the tree is modified via C or Tcl. |
| 78 |
.SH SYNTAX |
| 79 |
.DS |
| 80 |
\fBtreeview \fIpathName \fR?\fIoption value\fR?... |
| 81 |
.DE |
| 82 |
The \fBtreeview\fR command creates a new window \fIpathName\fR and |
| 83 |
makes it into a \fBtreeview\fR widget. At the time this command is |
| 84 |
invoked, there must not exist a window named \fIpathName\fR, but |
| 85 |
\fIpathName\fR's parent must exist. Additional options may be |
| 86 |
specified on the command line or in the option database to configure |
| 87 |
aspects of the widget such as its colors and font. See the |
| 88 |
\fBconfigure\fR operation below for the exact details about what |
| 89 |
\fIoption\fR and \fIvalue\fR pairs are valid. |
| 90 |
.PP |
| 91 |
If successful, \fBtreeview\fR returns the path name of the widget. It |
| 92 |
also creates a new Tcl command by the same name. You can use this |
| 93 |
command to invoke various operations that query or modify the widget. |
| 94 |
The general form is: |
| 95 |
.DS |
| 96 |
\fIpathName \fIoperation\fR \fR?\fIarg\fR?... |
| 97 |
.DE |
| 98 |
Both \fIoperation\fR and its arguments determine the exact behavior of |
| 99 |
the command. The operations available are described in the |
| 100 |
.SB "TREEVIEW OPERATIONS" |
| 101 |
section. |
| 102 |
.SH "IDS AND TAGS" |
| 103 |
Nodes can be inserted into a tree using the \fBtreeview\fR widget |
| 104 |
.CS |
| 105 |
blt::treeview .t |
| 106 |
set node [.t insert end root "one"] |
| 107 |
.CE |
| 108 |
or \fBtree\fR command. |
| 109 |
.CS |
| 110 |
set tree [blt::tree create] |
| 111 |
set node [$tree insert root "one"] |
| 112 |
.CE |
| 113 |
In both cases, a number identifying the node is returned (the value of |
| 114 |
\fB$node\fR). This serial number or \fIid\fR uniquely identifies |
| 115 |
the node. Please note that you can't infer a location or position of |
| 116 |
a node from its id. The only exception is that the root node is |
| 117 |
always id \fB0\fR. Since nodes may have the same labels or be moved |
| 118 |
within the tree, ids provide an convenient way to identify nodes. If |
| 119 |
a tree is shared, the ids will be the same regardless if you are using |
| 120 |
by the \fBtreeview\fR widget or the \fBtree\fR command. Ids are |
| 121 |
recycled when the node deleted. |
| 122 |
.PP |
| 123 |
A node may also have any number of \fItags\fR associated with it. A |
| 124 |
tag is just a string of characters, and it may take any form except |
| 125 |
that of an integer. For example, "\fBx123\fR" is valid, but |
| 126 |
"\fB123\fR" isn't. The same tag may be associated with many |
| 127 |
different nodes. This is typically done to associate a group of |
| 128 |
nodes. Many operations in the \fBtreeview\fR widget take either node |
| 129 |
ids or tag names as arguments. Using a tag says to apply the operation |
| 130 |
to all nodes with that tag. |
| 131 |
.PP |
| 132 |
The tag \fBall\fR is implicitly associated with every node in |
| 133 |
the tree. It may be used to invoke operations on all the nodes in the |
| 134 |
tree. |
| 135 |
.PP |
| 136 |
Tags may be shared, just like trees, between clients. For example, |
| 137 |
you can use the tags created by the \fBtree\fR command with |
| 138 |
\fBtreeview\fR widgets. |
| 139 |
.SH SPECIAL NODE IDS |
| 140 |
There are also several special non-numeric ids. Special ids differ |
| 141 |
from tags in that they are always translated to their numeric |
| 142 |
equivalent. They also take precedence over tags. For example, you |
| 143 |
can't use a tag name that is a special id. These ids are specific to |
| 144 |
the \fBtreeview\fR widget. |
| 145 |
.TP 15 |
| 146 |
\fBactive\fR |
| 147 |
The node where the mouse pointer is currently located. |
| 148 |
When a node is active, it is drawn using its active icon |
| 149 |
(see the \fB\-activeicon\fR option). |
| 150 |
The \fBactive\fR id is changed automatically by moving the mouse |
| 151 |
pointer over another node or by using the \fBentry activate\fR |
| 152 |
operation. Note that there can be only one active node at a time. |
| 153 |
.TP 15 |
| 154 |
\fBanchor\fR |
| 155 |
The node representing the fixed end of the current selection. |
| 156 |
The anchor is set by the \fBselection anchor\fR operation. |
| 157 |
.TP 15 |
| 158 |
\fBcurrent\fR |
| 159 |
The node where the mouse pointer is currently located. |
| 160 |
But unlike \fBactive\fR, this id changes while the |
| 161 |
selection is dragged. It is used to determine the |
| 162 |
current node during button drags. |
| 163 |
.TP 15 |
| 164 |
\fBdown\fR |
| 165 |
The next open node from the current focus. The \fBdown\fR of |
| 166 |
the last open node is the same. |
| 167 |
.TP 15 |
| 168 |
\fBend\fR |
| 169 |
The last open node (in depth-first order) on the tree. |
| 170 |
.TP 15 |
| 171 |
\fBfocus\fR |
| 172 |
The node that currently has focus. When a node has focus, |
| 173 |
it receives key events. To indicate focus, the node |
| 174 |
is drawn with a dotted line around its label. You can change the |
| 175 |
focus using the \fBfocus\fR operation. |
| 176 |
.TP 15 |
| 177 |
\fBlast\fR |
| 178 |
The last open node from the current focus. But unlike \fBup\fR, |
| 179 |
when the focus is at root, \fBlast\fR wraps around to the last |
| 180 |
open node in the tree. |
| 181 |
.TP 15 |
| 182 |
\fBmark\fR |
| 183 |
The node representing the non-fixed end of the current selection. |
| 184 |
The mark is set by the \fBselection mark\fR operation. |
| 185 |
.TP 15 |
| 186 |
\fBnext\fR |
| 187 |
The next open node from the current focus. But unlike \fBdown\fR, |
| 188 |
when the focus is on last open node, \fBnext\fR wraps around to the |
| 189 |
root node. |
| 190 |
.TP 15 |
| 191 |
\fBnextsibling\fR |
| 192 |
The next sibling from the node with the current focus. If the node |
| 193 |
is already the last sibling then it is the \fBnextsibling\fB. |
| 194 |
.TP 15 |
| 195 |
\fBparent\fR |
| 196 |
The parent of the node with the current focus. The \fBparent\fR |
| 197 |
of the root is also the root. |
| 198 |
.TP 15 |
| 199 |
\fBprevsibling\fR |
| 200 |
The previous sibling from the node with the current focus. If the node |
| 201 |
is already the first sibling then it is the \fBprevsibling\fB. |
| 202 |
.TP 15 |
| 203 |
\fBroot\fR |
| 204 |
The root node. You can also use id \fB0\fR to indicate |
| 205 |
the root. |
| 206 |
.TP 15 |
| 207 |
\fBup\fR |
| 208 |
The last open node (in depth-first order) from the current focus. The |
| 209 |
\fBup\fR of the root node (i.e. the root has focus) is also the root. |
| 210 |
.TP 15 |
| 211 |
\fBview.top\fR |
| 212 |
First node that's current visible in the widget. |
| 213 |
.TP 15 |
| 214 |
\fBview.bottom\fR |
| 215 |
Last node that's current visible in the widget. |
| 216 |
.TP 15 |
| 217 |
\fIpath\fR |
| 218 |
Absolute path of a node. Path names refer to the node name, not |
| 219 |
their entry labels. Paths don't have to start with a separator (see |
| 220 |
the \fB\-separator\fR configuration option), but component names must |
| 221 |
be separated by the designated separator. |
| 222 |
.TP 15 |
| 223 |
\fB@\fIx\fB,\fIy\fR |
| 224 |
Indicates the node that covers the point in the treeview window |
| 225 |
specified by \fIx\fR and \fIy\fR (in pixel coordinates). If no |
| 226 |
part of the entryd covers that point, then the closest node to that |
| 227 |
point is used. |
| 228 |
.PP |
| 229 |
A node may be specified as an id or tag. If the specifier is an |
| 230 |
integer then it is assumed to refer to the single node with that id. |
| 231 |
If the specifier is not an integer, it's checked to see if it's a |
| 232 |
special id (such as focus). Otherwise, it's assumed to be tag. Some |
| 233 |
operations only operate on a single node at a time; if a tag refers to |
| 234 |
more than one node, then an error is generated. |
| 235 |
.SH DATA FIELDS |
| 236 |
A node in the tree can have \fIdata fields\fR. A data field is a |
| 237 |
name-value pair, used to represent arbitrary data in the node. Nodes |
| 238 |
can contain different fields (they aren't required to contain the same |
| 239 |
fields). You can optionally display these fields in the |
| 240 |
\fBtreeview\fR widget in columns running on either side of the |
| 241 |
displayed tree. A node's value for the field is drawn in the column |
| 242 |
along side its node in the hierarchy. Any node that doesn't have a |
| 243 |
specific field is left blank. Columns can be interactively resized, |
| 244 |
hidden, or, moved. |
| 245 |
.SH ENTRY BINDINGS |
| 246 |
You can bind Tcl commands to be invoked when events occur on nodes |
| 247 |
(much like Tk canvas items). You can bind a node using its id or |
| 248 |
its \fIbindtags\fR. Bindtags are simply names that associate a |
| 249 |
binding with one or more nodes. There is a built-in tag \fBall\fR |
| 250 |
that all node entries automatically have. |
| 251 |
.SH "TREEVIEW OPERATIONS" |
| 252 |
The \fBtreeview\fR operations are the invoked by specifying |
| 253 |
the widget's pathname, the operation, and any arguments that pertain |
| 254 |
to that operation. The general form is: |
| 255 |
.sp |
| 256 |
.CS |
| 257 |
\fIpathName operation \fR?\fIarg arg ...\fR? |
| 258 |
.CE |
| 259 |
.sp |
| 260 |
\fIOperation\fR and the \fIarg\fRs determine the exact behavior of the |
| 261 |
command. The following operation are available for \fBtreeview\fR widgets: |
| 262 |
.TP |
| 263 |
\fIpathName \fBbbox\fR ?\fB-screen\fR? \fItagOrId...\fR |
| 264 |
Returns a list of 4 numbers, representing a bounding box of around |
| 265 |
the specified entries. The entries is given by one or more \fItagOrId\fR |
| 266 |
arguments. |
| 267 |
If the \fB\-screen\fR flag is given, then the x-y coordinates |
| 268 |
of the bounding box are returned as screen coordinates, not |
| 269 |
virtual coordinates. Virtual coordinates start from \fB0\fR from the |
| 270 |
root node. |
| 271 |
The returned list contains the following values. |
| 272 |
.RS |
| 273 |
.TP 1.25i |
| 274 |
\fIx\fR |
| 275 |
X-coordinate of the upper-left corner of the bounding box. |
| 276 |
.TP |
| 277 |
\fIy\fR |
| 278 |
Y-coordinate of the upper-left corner of the bounding box. |
| 279 |
.TP |
| 280 |
\fIwidth\fR |
| 281 |
Width of the bounding box. |
| 282 |
.TP |
| 283 |
\fIheight\fR |
| 284 |
Height of the bounding box. |
| 285 |
.RE |
| 286 |
.TP |
| 287 |
\fIpathName \fBbind\fR \fItagName\fR ?\fIsequence command\fR? |
| 288 |
Associates \fIcommand\fR with \fItagName\fR such that whenever the |
| 289 |
event sequence given by \fIsequence\fR occurs for a node with this |
| 290 |
tag, \fIcommand\fR will be invoked. The syntax is similar to the |
| 291 |
\fBbind\fR command except that it operates on \fBtreeview\fR entries, |
| 292 |
rather than widgets. See the \fBbind\fR manual entry for |
| 293 |
complete details on \fIsequence\fR and the substitutions performed on |
| 294 |
\fIcommand\fR before invoking it. |
| 295 |
.sp |
| 296 |
If all arguments are specified then a new binding is created, replacing |
| 297 |
any existing binding for the same \fIsequence\fR and \fItagName\fR. |
| 298 |
If the first character of \fIcommand\fR is \fB+\fR then \fIcommand\fR |
| 299 |
augments an existing binding rather than replacing it. |
| 300 |
If no \fIcommand\fR argument is provided then the command currently |
| 301 |
associated with \fItagName\fR and \fIsequence\fR (it's an error occurs |
| 302 |
if there's no such binding) is returned. If both \fIcommand\fR and |
| 303 |
\fIsequence\fR are missing then a list of all the event sequences for |
| 304 |
which bindings have been defined for \fItagName\fR. |
| 305 |
.TP |
| 306 |
\fIpathName \fBbutton \fIoperation\fR ?\fIargs\fR? |
| 307 |
This command is used to control the button selectors within a |
| 308 |
\fBtreeview\fR widget. |
| 309 |
It has several forms, depending on \fIoperation\fR: |
| 310 |
.RS |
| 311 |
.TP |
| 312 |
\fIpathName \fBbutton activate\fR \fItagOrId\fR |
| 313 |
Designates the node given by \fItagOrId\fR as active. |
| 314 |
When a node is active it's entry is drawn using its active icon |
| 315 |
(see the \fB\-activeicon\fR option). |
| 316 |
Note that there can be only one active entry at a time. |
| 317 |
The special id \fBactive\fR indicates the currently active node. |
| 318 |
.TP |
| 319 |
\fIpathName \fBbutton bind\fR \fItagName\fR ?\fIsequence command\fR? |
| 320 |
Associates \fIcommand\fR with \fItagName\fR such that whenever the |
| 321 |
event sequence given by \fIsequence\fR occurs for an button of a |
| 322 |
node entry with this tag, \fIcommand\fR will be invoked. The syntax is |
| 323 |
similar to the \fBbind\fR command except that it operates on |
| 324 |
\fBtreeview\fR buttons, rather than widgets. See the \fBbind\fR |
| 325 |
manual entry for complete details on \fIsequence\fR and the |
| 326 |
substitutions performed on \fIcommand\fR before invoking it. |
| 327 |
.sp |
| 328 |
If all arguments are specified then a new binding is created, replacing |
| 329 |
any existing binding for the same \fIsequence\fR and \fItagName\fR. |
| 330 |
If the first character of \fIcommand\fR is \fB+\fR then \fIcommand\fR |
| 331 |
augments an existing binding rather than replacing it. |
| 332 |
If no \fIcommand\fR argument is provided then the command currently |
| 333 |
associated with \fItagName\fR and \fIsequence\fR (it's an error occurs |
| 334 |
if there's no such binding) is returned. If both \fIcommand\fR and |
| 335 |
\fIsequence\fR are missing then a list of all the event sequences for |
| 336 |
which bindings have been defined for \fItagName\fR. |
| 337 |
.TP |
| 338 |
\fIpathName \fBbutton cget\fR \fIoption\fR |
| 339 |
Returns the current value of the configuration option given |
| 340 |
by \fIoption\fR. |
| 341 |
\fIOption\fR may have any of the values accepted by the \fBconfigure\fR |
| 342 |
operation described below. |
| 343 |
.TP |
| 344 |
\fIpathName \fBbutton configure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 345 |
Query or modify the configuration options of the widget. |
| 346 |
If no \fIoption\fR is specified, returns a list describing all of |
| 347 |
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 348 |
information on the format of this list). If \fIoption\fR is specified |
| 349 |
with no \fIvalue\fR, then the command returns a list describing the |
| 350 |
one named option (this list will be identical to the corresponding |
| 351 |
sublist of the value returned if no \fIoption\fR is specified). If |
| 352 |
one or more \fIoption\-value\fR pairs are specified, then the command |
| 353 |
modifies the given widget option(s) to have the given value(s); in |
| 354 |
this case the command returns an empty string. |
| 355 |
\fIOption\fR and \fIvalue\fR are described in the section |
| 356 |
.SB "BUTTON OPTIONS" |
| 357 |
below. |
| 358 |
.RE |
| 359 |
.TP |
| 360 |
\fIpathName \fBcget\fR \fIoption\fR |
| 361 |
Returns the current value of the configuration option given |
| 362 |
by \fIoption\fR. |
| 363 |
\fIOption\fR may have any of the values accepted by the \fBconfigure\fR |
| 364 |
operation described below. |
| 365 |
.TP |
| 366 |
\fIpathName \fBclose \fR?\fB\-recurse\fR? \fItagOrId...\fR |
| 367 |
Closes the node specified by \fItagOrId\fR. In addition, if a Tcl |
| 368 |
script was specified by the \fB\-closecommand\fR option, it is |
| 369 |
invoked. If the node is already closed, this command has no effect. |
| 370 |
If the \fB\-recurse\fR flag is present, each child node is |
| 371 |
recursively closed. |
| 372 |
.TP |
| 373 |
\fIpathName \fBcolumn \fIoperation\fR ?\fIargs\fR? |
| 374 |
The following operations are available for treeview columns. |
| 375 |
.RS |
| 376 |
.TP |
| 377 |
\fIpathName \fBcolumn activate\fR \fIcolumn\fR |
| 378 |
Sets the active column to \fIcolumn\fR. \fIColumn\fR is the |
| 379 |
name of a column in the widget. |
| 380 |
When a column is active, it's drawn using its \fB\-activetitlebackground\fR |
| 381 |
and \fB\-activetitleforeground\fR options. If \fIcolumn\fR is the \fB""\fR, |
| 382 |
then no column will be active. If no column argument is provided, then |
| 383 |
the name of the currently active column is returned. |
| 384 |
.TP |
| 385 |
\fIpathName \fBcolumn cget\fR \fIname\fR \fIoption\fR |
| 386 |
Returns the current value of the column configuration option given |
| 387 |
by \fIoption\fR for \fIname\fR. \fIName\fR is the name of column |
| 388 |
that corresponds to a data field. |
| 389 |
\fIOption\fR may have any of the values accepted by the \fBconfigure\fR |
| 390 |
operation described below. |
| 391 |
.TP |
| 392 |
\fIpathName \fBcolumn configure\fR \fIname\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 393 |
Query or modify the configuration options of the column designated |
| 394 |
by \fIname\fR. \fIName\fR is the name of the column corresponding |
| 395 |
to a data field. |
| 396 |
If no \fIoption\fR is specified, returns a list describing all of |
| 397 |
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 398 |
information on the format of this list). If \fIoption\fR is specified |
| 399 |
with no \fIvalue\fR, then the command returns a list describing the |
| 400 |
one named option (this list will be identical to the corresponding |
| 401 |
sublist of the value returned if no \fIoption\fR is specified). If |
| 402 |
one or more \fIoption\-value\fR pairs are specified, then the command |
| 403 |
modifies the given widget option(s) to have the given value(s); in |
| 404 |
this case the command returns an empty string. |
| 405 |
\fIOption\fR and \fIvalue\fR are described in the section |
| 406 |
.SB "COLUMN OPTIONS" |
| 407 |
below. |
| 408 |
.TP |
| 409 |
\fIpathName \fBcolumn delete\fR \fIfield\fR ?\fIfield\fR...? |
| 410 |
Deletes one of more columns designated by \fIfield\fR. Note |
| 411 |
that this does not delete the data fields themselves. |
| 412 |
.TP |
| 413 |
\fIpathName \fBcolumn insert\fR \fIposition\fR \fIfield\fR ?\fIoptions\fR...? |
| 414 |
Inserts one of more columns designated by \fIfield\fR. A column displays |
| 415 |
each node's data field by the same name. If the node doesn't |
| 416 |
have the given field, the cell is left blank. |
| 417 |
\fIPosition\fR |
| 418 |
indicates where in the list of columns to add the new column. It may be |
| 419 |
either a number or \fBend\fR. |
| 420 |
.TP |
| 421 |
\fIpathName \fBcolumn invoke\fR \fIfield\fR |
| 422 |
Invokes the Tcl command associated with the column \fIfield\fR, |
| 423 |
if there is one (using the column's \fB\-command\fR option). |
| 424 |
The command is ignored if the column's \fB\-state\fR option |
| 425 |
set to \fBdisabled\fR. |
| 426 |
.TP |
| 427 |
\fIpathName \fBcolumn move \fIname\fR \fIdest\fR |
| 428 |
Moves the column \fIname\fR to the destination position. |
| 429 |
\fIDest\fR is the name of another column or a screen position |
| 430 |
in the form \fB@\fIx\fB,\fIy\fR. |
| 431 |
.TP |
| 432 |
\fIpathName \fBcolumn names\fR |
| 433 |
Returns a list of the names of all columns in the widget. |
| 434 |
The list is ordered as the columns are drawn from left-to-right. |
| 435 |
.TP |
| 436 |
\fIpathName \fBcolumn nearest\fR \fIx\fR ?\fIy\fR? |
| 437 |
Returns the name of the column closest to the given X-Y screen |
| 438 |
coordinate. If you provide a \fIy\fR argument (it's optional), |
| 439 |
a name is returned only when if the point is over a column's title. |
| 440 |
.RE |
| 441 |
.TP |
| 442 |
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 443 |
Query or modify the configuration options of the widget. |
| 444 |
If no \fIoption\fR is specified, returns a list describing all of |
| 445 |
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 446 |
information on the format of this list). If \fIoption\fR is specified |
| 447 |
with no \fIvalue\fR, then the command returns a list describing the |
| 448 |
one named option (this list will be identical to the corresponding |
| 449 |
sublist of the value returned if no \fIoption\fR is specified). If |
| 450 |
one or more \fIoption\-value\fR pairs are specified, then the command |
| 451 |
modifies the given widget option(s) to have the given value(s); in |
| 452 |
this case the command returns an empty string. |
| 453 |
\fIOption\fR and \fIvalue\fR are described in the section |
| 454 |
.SB "TREEVIEW OPTIONS" |
| 455 |
below. |
| 456 |
.TP |
| 457 |
\fIpathName \fBcurselection\fR |
| 458 |
Returns a list containing the ids of all of the entries that are |
| 459 |
currently selected. |
| 460 |
If there are no entries selected, then the empty string is returned. |
| 461 |
.TP |
| 462 |
\fIpathName \fBdelete \fItagOrId\fR... |
| 463 |
Deletes one or more entries given by \fItagOrId\fR and its children. |
| 464 |
.TP |
| 465 |
\fIpathName \fBentry \fIoperation\fR ?\fIargs\fR? |
| 466 |
The following operations are available for treeview entries. |
| 467 |
.RS |
| 468 |
.TP |
| 469 |
\fIpathName \fBentry activate\fR \fItagOrId\fR |
| 470 |
Sets the active entry to the one specified by \fItagOrId\fR. |
| 471 |
When an entry is active it is drawn using its active icon |
| 472 |
(see the \fB\-activeicon\fR option). |
| 473 |
Note that there can be only one active node at a time. |
| 474 |
The special id of the currently active node is \fBactive\fR. |
| 475 |
.TP |
| 476 |
\fIpathName \fBentry cget\fR \fIoption\fR |
| 477 |
Returns the current value of the configuration option given |
| 478 |
by \fIoption\fR. |
| 479 |
\fIOption\fR may have any of the values accepted by the \fBconfigure\fR |
| 480 |
operation described below. |
| 481 |
.TP |
| 482 |
\fIpathName \fBentry children\fR \fItagOrId\fR ?\fIfirst\fR? ?\fIlast\fR? |
| 483 |
Returns a list of ids for the given range of children of \fItagOrId\fR. |
| 484 |
\fITagOrId\fR is the id or tag of the node to be examined. |
| 485 |
If only a \fIfirst\fR argument is present, then the id |
| 486 |
of the that child at that numeric position is returned. If both \fIfirst\fR |
| 487 |
and \fIlast\fR arguments are given, then the ids of all the children |
| 488 |
in that range are returned. Otherwise the ids of all children |
| 489 |
are returned. |
| 490 |
.TP |
| 491 |
\fIpathName \fBentry configure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 492 |
Query or modify the configuration options of the widget. |
| 493 |
If no \fIoption\fR is specified, returns a list describing all of |
| 494 |
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 495 |
information on the format of this list). If \fIoption\fR is specified |
| 496 |
with no \fIvalue\fR, then the command returns a list describing the |
| 497 |
one named option (this list will be identical to the corresponding |
| 498 |
sublist of the value returned if no \fIoption\fR is specified). If |
| 499 |
one or more \fIoption\-value\fR pairs are specified, then the command |
| 500 |
modifies the given widget option(s) to have the given value(s); in |
| 501 |
this case the command returns an empty string. |
| 502 |
\fIOption\fR and \fIvalue\fR are described below: |
| 503 |
.TP |
| 504 |
\fIpathName \fBentry delete\fR \fItagOrId\fR ?\fIfirst\fR ?\fIlast\fR? |
| 505 |
Deletes the one or more children nodes of the parent \fItagOrId\fR. |
| 506 |
If \fIfirst\fR and \fIlast\fR arguments are present, they are |
| 507 |
positions designating a range of children nodes to be deleted. |
| 508 |
.TP |
| 509 |
\fIpathName \fBentry isbefore \fItagOrId1\fR \fItagOrId2\fR |
| 510 |
Returns 1 if \fItagOrId1\fR is before \fItagOrId2\fR and 0 otherwise. |
| 511 |
.TP |
| 512 |
\fIpathName \fBentry ishidden \fItagOrId\fR |
| 513 |
Returns 1 if the node is currently hidden and 0 otherwise. A node is |
| 514 |
also hidden if any of its ancestor nodes are closed or hidden. |
| 515 |
.TP |
| 516 |
\fIpathName \fBentry isopen \fItagOrId\fR |
| 517 |
Returns 1 if the node is currently open and 0 otherwise. |
| 518 |
.TP |
| 519 |
\fIpathName \fBentry size\fR \fB\-recurse\fR \fItagOrId\fR |
| 520 |
Returns the number of children for parent node \fItagOrId\fR. |
| 521 |
If the \fB\-recurse\fR flag is set, the number of all |
| 522 |
its descendants is returned. The node itself is not counted. |
| 523 |
.RE |
| 524 |
.TP |
| 525 |
\fIpathName \fBfind \fR?\fIflags\fR? \fIfirst\fR \fIlast\fR |
| 526 |
Finds for all entries matching the criteria given by \fIflags\fR. A |
| 527 |
list of ids for all matching nodes is returned. \fIFirst\fR and |
| 528 |
\fIlast\fR are ids designating the range of the search in |
| 529 |
depth-first order. If \fIlast\fR is before \fIfirst\fR, then nodes |
| 530 |
are searched in reverse order. The valid flags are: |
| 531 |
.RS |
| 532 |
.TP 1.25i |
| 533 |
\fB\-name\fI pattern\fR |
| 534 |
Specifies pattern to match against node names. |
| 535 |
.TP 1.25i |
| 536 |
\fB\-full\fI pattern\fR |
| 537 |
Specifies pattern to match against node pathnames. |
| 538 |
.TP 1.25i |
| 539 |
\fB\-\fIoption\fI pattern\fR |
| 540 |
Specifies pattern to match against the node entry's configuration option. |
| 541 |
.TP 1.25i |
| 542 |
\fB\-exact\fR |
| 543 |
Patterns must match exactly. The is the default. |
| 544 |
.TP 1.25i |
| 545 |
\fB\-glob\fR |
| 546 |
Use global pattern matching. Matching is done in a fashion |
| 547 |
similar to that used by the C-shell. For the two |
| 548 |
strings to match, their contents must be identical |
| 549 |
except that the following special sequences may |
| 550 |
appear in pattern: |
| 551 |
.RS |
| 552 |
.TP 5 |
| 553 |
\fB*\fR |
| 554 |
Matches any sequence of characters in |
| 555 |
string, including a null string. |
| 556 |
.TP 5 |
| 557 |
\fB?\fR |
| 558 |
Matches any single character in string. |
| 559 |
.TP 5 |
| 560 |
\fB[\fIchars\fB]\fR |
| 561 |
Matches any character in the set given by \fIchars\fR. If a sequence of the |
| 562 |
form \fIx\fR-\fIy\fR appears in \fIchars\fR, then any character between |
| 563 |
\fIx\fR and \fIy\fR, |
| 564 |
inclusive, will match. |
| 565 |
.TP 5 |
| 566 |
\fB\\\fIx\fR |
| 567 |
Matches the single character \fIx\fR. This |
| 568 |
provides a way of avoiding the special |
| 569 |
interpretation of the characters \fB*?[]\\\fR in |
| 570 |
the pattern. |
| 571 |
.RE |
| 572 |
.TP 1.25i |
| 573 |
\fB\-regexp\fR |
| 574 |
Use regular expression pattern matching (i.e. the same as implemented |
| 575 |
by the \fBregexp\fR command). |
| 576 |
.TP 1.25i |
| 577 |
\fB\-nonmatching\fR |
| 578 |
Pick entries that don't match. |
| 579 |
.TP 1.25i |
| 580 |
\fB\-exec\fI string\fR |
| 581 |
Specifies a Tcl script to be invoked for each matching node. |
| 582 |
Percent substitutions are performed on \fIstring\fR before |
| 583 |
it is executed. The following substitutions are valid: |
| 584 |
.RS |
| 585 |
.TP 5 |
| 586 |
\fB%W\fR |
| 587 |
The pathname of the widget. |
| 588 |
.TP 5 |
| 589 |
\fB%p\fR |
| 590 |
The name of the node. |
| 591 |
.TP 5 |
| 592 |
\fB%P\fR |
| 593 |
The full pathname of the node. |
| 594 |
.TP 5 |
| 595 |
\fB%#\fR |
| 596 |
The id of the node. |
| 597 |
.TP 5 |
| 598 |
\fB%%\fR |
| 599 |
Translates to a single percent. |
| 600 |
.RE |
| 601 |
.TP 1.25i |
| 602 |
\fB\-count\fI number\fR |
| 603 |
Stop searching after \fInumber\fR matches. |
| 604 |
.TP 1.25i |
| 605 |
\fB\-\-\fR |
| 606 |
Indicates the end of flags. |
| 607 |
.RE |
| 608 |
.TP |
| 609 |
\fIpathName \fBfocus \fR \fItagOrId\fR |
| 610 |
Sets the focus to the node given by \fItagOrId\fR. When a node |
| 611 |
has focus, it can receive keyboard events. |
| 612 |
The special id \fBfocus\fR designates the node that currently has focus. |
| 613 |
.TP |
| 614 |
\fIpathName \fBget \fR?\fB\-full\fR? \fItagOrId\fR \fItagOrId\fR... |
| 615 |
Translates one or more ids to their node entry names. It returns a list of |
| 616 |
names for all the ids specified. If the \fB\-full\fR |
| 617 |
flag is set, then the full pathnames are returned. |
| 618 |
.TP |
| 619 |
\fIpathName \fBhide \fR?\fBflags\fR? \fItagOrId\fR... |
| 620 |
Hides all nodes matching the criteria given by \fIflags\fR. The |
| 621 |
search is performed recursively for each node given by \fItagOrId\fR. |
| 622 |
The valid flags are described below: |
| 623 |
.RS |
| 624 |
.TP 1.25i |
| 625 |
\fB\-name\fI pattern\fR |
| 626 |
Specifies pattern to match against node names. |
| 627 |
.TP 1.25i |
| 628 |
\fB\-full\fI pattern\fR |
| 629 |
Specifies pattern to match against node pathnames. |
| 630 |
.TP 1.25i |
| 631 |
\fB\-\fIoption\fI pattern\fR |
| 632 |
Specifies pattern to match against the node entry's configuration option. |
| 633 |
.TP 1.25i |
| 634 |
\fB\-exact\fR |
| 635 |
Match patterns exactly. The is the default. |
| 636 |
.TP 1.25i |
| 637 |
\fB\-glob\fR |
| 638 |
Use global pattern matching. Matching is done in a fashion |
| 639 |
similar to that used by the C-shell. For the two |
| 640 |
strings to match, their contents must be identical |
| 641 |
except that the following special sequences may |
| 642 |
appear in pattern: |
| 643 |
.RS |
| 644 |
.TP 5 |
| 645 |
\fB*\fR |
| 646 |
Matches any sequence of characters in |
| 647 |
string, including a null string. |
| 648 |
.TP 5 |
| 649 |
\fB?\fR |
| 650 |
Matches any single character in string. |
| 651 |
.TP 5 |
| 652 |
\fB[\fIchars\fB]\fR |
| 653 |
Matches any character in the set given by \fIchars\fR. If a sequence of the |
| 654 |
form \fIx\fR-\fIy\fR appears in \fIchars\fR, then any character between |
| 655 |
\fIx\fR and \fIy\fR, |
| 656 |
inclusive, will match. |
| 657 |
.TP 5 |
| 658 |
\fB\\\fIx\fR |
| 659 |
Matches the single character \fIx\fR. This |
| 660 |
provides a way of avoiding the special |
| 661 |
interpretation of the characters \fB*?[]\\\fR in |
| 662 |
the pattern. |
| 663 |
.RE |
| 664 |
.TP 1.25i |
| 665 |
\fB\-regexp\fR |
| 666 |
Use regular expression pattern matching (i.e. the same as implemented |
| 667 |
by the \fBregexp\fR command). |
| 668 |
.TP 1.25i |
| 669 |
\fB\-nonmatching\fR |
| 670 |
Hide nodes that don't match. |
| 671 |
.TP 1.25i |
| 672 |
\fB\-\-\fR |
| 673 |
Indicates the end of flags. |
| 674 |
.RE |
| 675 |
.TP |
| 676 |
\fIpathName \fBindex \fR?\fB\-at\fR \fItagOrId\fR? \fIstring\fR |
| 677 |
Returns the id of the node specified by \fIstring\fR. \fIString\fR |
| 678 |
may be a tag or node id. |
| 679 |
Some special ids are normally relative to the node that |
| 680 |
has focus. The \fB\-at\fR flag lets you select another node. |
| 681 |
.TP |
| 682 |
\fIpathName \fBinsert \fR?\fB\-at \fItagOrId\fR? \fIposition\fR \fIpath\fR ?\fIoptions...\fR? ?\fIpath\fR? ?\fIoptions...\fR? |
| 683 |
Inserts one or more nodes at \fIposition\fR. \fIPosition\fR is the |
| 684 |
location (number or \fBend\fR) where the new nodes are added to |
| 685 |
the parent node. \fIPath\fR is the pathname of the new node. |
| 686 |
Pathnames can be formated either as a Tcl list (each element is a path |
| 687 |
component) or as a string separated by a special character sequence |
| 688 |
(using the \fB\-separator\fR option). Pathnames are normally |
| 689 |
absolute, but the \fB\-at\fR switch lets you select a relative |
| 690 |
starting point. Its value is the id of the starting node. |
| 691 |
.sp |
| 692 |
All ancestors of the new node must already exist, unless the |
| 693 |
\fB\-autocreate\fR option is set. It is also an error if a node |
| 694 |
already exists, unless the \fB\-allowduplicates\fR option is set. |
| 695 |
.sp |
| 696 |
\fIOption\fR and \fIvalue\fR may have any of the values accepted by the |
| 697 |
\fBentry configure\fR operation described in the |
| 698 |
.SB "ENTRY OPERATIONS" |
| 699 |
section below. This command returns a list of the ids of |
| 700 |
the new entries. |
| 701 |
.TP |
| 702 |
\fIpathName \fBmove \fItagOrId\fR \fIhow\fR \fIdestId\fR |
| 703 |
Moves the node given by \fItagOrId\fR to the destination node. The |
| 704 |
node can not be an ancestor of the destination. \fIDestId\fR is |
| 705 |
the id of the destination node and can not be the root of the |
| 706 |
tree. In conjunction with \fIhow\fR, it describes how the move is |
| 707 |
performed. |
| 708 |
.RS |
| 709 |
.TP 8 |
| 710 |
\fBbefore\fR |
| 711 |
Moves the node before the destination node. |
| 712 |
.TP 8 |
| 713 |
\fBafter\fR |
| 714 |
Moves the node after the destination node. |
| 715 |
.TP 8 |
| 716 |
\fBinto\fR |
| 717 |
Moves the node to the end of the destination's list of children. |
| 718 |
.RE |
| 719 |
.TP |
| 720 |
\fIpathName \fBnearest \fIx y\fR ?\fIvarName\fR? |
| 721 |
Returns the id of the node entry closest to the given X-Y screen |
| 722 |
coordinate. The optional argument \fIvarName\fR is the name of |
| 723 |
variable which is set to either \fBbutton\fR or \fBselect\fR to |
| 724 |
indicate over what part of the node the coordinate lies. |
| 725 |
If the coordinate is not directly over any node, then |
| 726 |
\fIvarName\fR will contain the empty string. |
| 727 |
.TP |
| 728 |
\fIpathName \fBopen \fR?\fB\-recurse\fR? \fItagOrId...\fR |
| 729 |
Opens the one or more nodes specified by \fItagOrId\fR. |
| 730 |
If a node is not already open, the Tcl script specified by the |
| 731 |
\fB\-opencommand\fR option is invoked. If the \fB\-recurse\fR flag |
| 732 |
is present, then each descendant is recursively opened. |
| 733 |
.TP |
| 734 |
\fIpathName \fBrange\fR ?\fB-open\fR? \fIfirst last\fR |
| 735 |
Returns the ids in depth-first order of the nodes |
| 736 |
between the \fIfirst\fR and \fIlast\fR ids. If the \fB\-open\fR |
| 737 |
flag is present, it indicates to consider only open nodes. |
| 738 |
If \fIlast\fR is before \fIfirst\fR, then the ids are |
| 739 |
returned in reverse order. |
| 740 |
.TP |
| 741 |
\fIpathName \fBscan\fR \fIoption args\fR |
| 742 |
This command implements scanning. It has |
| 743 |
two forms, depending on \fIoption\fR: |
| 744 |
.RS |
| 745 |
.TP |
| 746 |
\fIpathName \fBscan mark \fIx y\fR |
| 747 |
Records \fIx\fR and \fIy\fR and the current view in the treeview |
| 748 |
window; used in conjunction with later \fBscan dragto\fR commands. |
| 749 |
Typically this command is associated with a mouse button press in |
| 750 |
the widget. It returns an empty string. |
| 751 |
.TP |
| 752 |
\fIpathName \fBscan dragto \fIx y\fR. |
| 753 |
Computes the difference between its \fIx\fR and \fIy\fR |
| 754 |
arguments and the \fIx\fR and \fIy\fR arguments to the last |
| 755 |
\fBscan mark\fR command for the widget. |
| 756 |
It then adjusts the view by 10 times the |
| 757 |
difference in coordinates. This command is typically associated |
| 758 |
with mouse motion events in the widget, to produce the effect of |
| 759 |
dragging the list at high speed through the window. The return |
| 760 |
value is an empty string. |
| 761 |
.RE |
| 762 |
.TP |
| 763 |
\fIpathName \fBsee\fR ?\fB\-anchor \fIanchor\fR? \fItagOrId\fR |
| 764 |
Adjusts the view of entries so that the node given by \fItagOrId\fR is |
| 765 |
visible in the widget window. It is an error if \fBtagOrId\fR is a |
| 766 |
tag that refers to more than one node. By default the node's entry |
| 767 |
is displayed in the middle of the window. This can changed using the |
| 768 |
\fB\-anchor\fR flag. Its value is a Tk anchor position. |
| 769 |
.TP |
| 770 |
\fIpathName \fBselection \fIoption arg\fR |
| 771 |
This command is used to adjust the selection within a \fBtreeview\fR |
| 772 |
widget. It has several forms, depending on \fIoption\fR: |
| 773 |
.RS |
| 774 |
.TP |
| 775 |
\fIpathName \fBselection anchor \fItagOrId\fR |
| 776 |
Sets the selection anchor to the node given by \fItagOrId\fR. |
| 777 |
If \fItagOrId\fR refers to a non-existent node, then the closest |
| 778 |
node is used. |
| 779 |
The selection anchor is the end of the selection that is fixed |
| 780 |
while dragging out a selection with the mouse. |
| 781 |
The special id \fBanchor\fR may be used to refer to the anchor |
| 782 |
node. |
| 783 |
.TP |
| 784 |
\fIpathName \fBselection cancel\fR |
| 785 |
Clears the temporary selection of entries back to the |
| 786 |
current anchor. Temporary selections are created by |
| 787 |
the \fBselection mark\fR operation. |
| 788 |
.TP |
| 789 |
\fIpathName \fBselection clear \fIfirst \fR?\fIlast\fR? |
| 790 |
Removes the entries between \fIfirst\fR and \fIlast\fR |
| 791 |
(inclusive) from the selection. Both \fIfirst\fR and |
| 792 |
\fIlast\fR are ids representing a range of entries. |
| 793 |
If \fIlast\fR isn't given, then only \fIfirst\fR is deselected. |
| 794 |
Entries outside the selection are not affected. |
| 795 |
.TP |
| 796 |
\fIpathName \fBselection clearall\fR |
| 797 |
Clears the entire selection. |
| 798 |
.TP |
| 799 |
\fIpathName \fBselection mark \fItagOrId\fR |
| 800 |
Sets the selection mark to the node given by \fItagOrId\fR. This |
| 801 |
causes the range of entries between the anchor and the mark to be |
| 802 |
temporarily added to the selection. The selection mark is the end of |
| 803 |
the selection that is fixed while dragging out a selection with the |
| 804 |
mouse. The special id \fBmark\fR may be used to refer to the current |
| 805 |
mark node. |
| 806 |
If \fItagOrId\fR refers to a non-existent node, then the mark |
| 807 |
is ignored. |
| 808 |
Resetting the mark will unselect |
| 809 |
the previous range. Setting the anchor finalizes the range. |
| 810 |
.TP |
| 811 |
\fIpathName \fBselection includes \fItagOrId\fR |
| 812 |
Returns 1 if the node given by \fItagOrId\fR is currently |
| 813 |
selected, 0 if it isn't. |
| 814 |
.TP |
| 815 |
\fIpathName \fBselection present\fR |
| 816 |
Returns 1 if any nodes are currently selected and 0 otherwise. |
| 817 |
.TP |
| 818 |
\fIpathName \fBselection set \fIfirst \fR?\fIlast\fR? |
| 819 |
Selects all of the nodes in the range between |
| 820 |
\fIfirst\fR and \fIlast\fR, inclusive, without affecting |
| 821 |
the selection state of nodes outside that range. |
| 822 |
.TP |
| 823 |
\fIpathName \fBselection toggle \fIfirst \fR?\fIlast\fR? |
| 824 |
Selects/deselects nodes in the range between |
| 825 |
\fIfirst\fR and \fIlast\fR, inclusive, from the selection. |
| 826 |
If a node is currently selected, it becomes deselected, and |
| 827 |
visa versa. |
| 828 |
.RE |
| 829 |
.TP |
| 830 |
\fIpathName \fBshow \fR?\fBflags\fR? \fItagOrId\fR... |
| 831 |
Exposes all nodes matching the criteria given by \fIflags\fR. This |
| 832 |
is the inverse of the \fBhide\fR operation. The search is performed |
| 833 |
recursively for each node given by \fItagOrId\fR. The valid flags are |
| 834 |
described below: |
| 835 |
.RS |
| 836 |
.TP 1.25i |
| 837 |
\fB\-name\fI pattern\fR |
| 838 |
Specifies pattern to match against node names. |
| 839 |
.TP 1.25i |
| 840 |
\fB\-full\fI pattern\fR |
| 841 |
Specifies pattern to match against node pathnames. |
| 842 |
.TP 1.25i |
| 843 |
\fB\-\fIoption\fI pattern\fR |
| 844 |
Specifies pattern to match against the entry's configuration option. |
| 845 |
.TP 1.25i |
| 846 |
\fB\-exact\fR |
| 847 |
Match patterns exactly. The is the default. |
| 848 |
.TP 1.25i |
| 849 |
\fB\-glob\fR |
| 850 |
\fB\-glob\fR |
| 851 |
Use global pattern matching. Matching is done in a fashion |
| 852 |
similar to that used by the C-shell. For the two |
| 853 |
strings to match, their contents must be identical |
| 854 |
except that the following special sequences may |
| 855 |
appear in pattern: |
| 856 |
.RS |
| 857 |
.TP 5 |
| 858 |
\fB*\fR |
| 859 |
Matches any sequence of characters in |
| 860 |
string, including a null string. |
| 861 |
.TP 5 |
| 862 |
\fB?\fR |
| 863 |
Matches any single character in string. |
| 864 |
.TP 5 |
| 865 |
\fB[\fIchars\fB]\fR |
| 866 |
Matches any character in the set given by \fIchars\fR. If a sequence of the |
| 867 |
form \fIx\fR-\fIy\fR appears in \fIchars\fR, then any character between |
| 868 |
\fIx\fR and \fIy\fR, |
| 869 |
inclusive, will match. |
| 870 |
.TP 5 |
| 871 |
\fB\\\fIx\fR |
| 872 |
Matches the single character \fIx\fR. This |
| 873 |
provides a way of avoiding the special |
| 874 |
interpretation of the characters \fB*?[]\\\fR in |
| 875 |
the pattern. |
| 876 |
.RE |
| 877 |
.TP 1.25i |
| 878 |
\fB\-regexp\fR |
| 879 |
Use regular expression pattern matching (i.e. the same as implemented |
| 880 |
by the \fBregexp\fR command). |
| 881 |
.TP 1.25i |
| 882 |
\fB\-nonmatching\fR |
| 883 |
Expose nodes that don't match. |
| 884 |
.TP 1.25i |
| 885 |
\fB\-\-\fR |
| 886 |
Indicates the end of flags. |
| 887 |
.RE |
| 888 |
.TP |
| 889 |
\fIpathName \fBsort\fR ?\fIoperation\fR? \fIargs...\fR |
| 890 |
.RS |
| 891 |
.TP |
| 892 |
\fIpathName \fBsort auto\fR ?\fIboolean\fR |
| 893 |
Turns on/off automatic sorting of node entries. If \fIboolean\fR is |
| 894 |
true, entries will be automatically sorted as they are opened, |
| 895 |
closed, inserted, or deleted. If no \fIboolean\fR argument is |
| 896 |
provided, the current state is returned. |
| 897 |
.TP |
| 898 |
\fIpathName \fBsort cget\fR \fIoption\fR |
| 899 |
Returns the current value of the configuration option given |
| 900 |
by \fIoption\fR. |
| 901 |
\fIOption\fR may have any of the values accepted by the \fBconfigure\fR |
| 902 |
operation described below. |
| 903 |
.TP |
| 904 |
\fIpathName \fBsort configure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? |
| 905 |
Query or modify the sorting configuration options of the widget. |
| 906 |
If no \fIoption\fR is specified, returns a list describing all of |
| 907 |
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for |
| 908 |
information on the format of this list). If \fIoption\fR is specified |
| 909 |
with no \fIvalue\fR, then the command returns a list describing the |
| 910 |
one named option (this list will be identical to the corresponding |
| 911 |
sublist of the value returned if no \fIoption\fR is specified). If |
| 912 |
one or more \fIoption\-value\fR pairs are specified, then the command |
| 913 |
modifies the given sorting option(s) to have the given value(s); in |
| 914 |
this case the command returns an empty string. |
| 915 |
\fIOption\fR and \fIvalue\fR are described below: |
| 916 |
.RS |
| 917 |
.TP |
| 918 |
\fB\-column\fI string\fR |
| 919 |
Specifies the column to sort. Entries in the widget are rearranged |
| 920 |
according to this column. If \fIcolumn\fR is \fB""\fR then |
| 921 |
no sort is performed. |
| 922 |
.TP |
| 923 |
\fB\-command\fI string\fR |
| 924 |
Specifies a Tcl procedure to be called when sorting nodes. |
| 925 |
The procedure is called with three arguments: the pathname of the widget |
| 926 |
and the fields of two entries. The procedure returns 1 if the first |
| 927 |
node is greater than the second, -1 is the second is greater, and 0 |
| 928 |
if equal. |
| 929 |
.TP |
| 930 |
\fB\-decreasing\fI boolean\fR |
| 931 |
Indicates to sort in ascending/descending order. If \fIboolean\fR |
| 932 |
is true, then the entries as in descending order. The default is |
| 933 |
\fBno\fR. |
| 934 |
.TP |
| 935 |
\fB\-mode\fI string\fR |
| 936 |
Specifies how to compare entries when sorting. \fIString\fR |
| 937 |
may be one of the following: |
| 938 |
.RS |
| 939 |
.TP 1.5i |
| 940 |
\fBascii\fR |
| 941 |
Use string comparison based upon the ASCII collation order. |
| 942 |
.TP 1.5i |
| 943 |
\fBdictionary\fR |
| 944 |
Use dictionary-style comparison. This is the same as \fBascii\fR |
| 945 |
except (a) case is ignored except as a tie-breaker and (b) if two |
| 946 |
strings contain embedded numbers, the numbers compare as integers, not |
| 947 |
characters. For example, "bigBoy" sorts between |
| 948 |
"bigbang" and "bigboy", and "x10y" sorts between "x9y" and "x11y". |
| 949 |
.TP 1.5i |
| 950 |
\fBinteger\fR |
| 951 |
Compares fields as integers. |
| 952 |
.TP 1.5i |
| 953 |
\fBreal\fR |
| 954 |
Compares fields as floating point numbers. |
| 955 |
.TP 1.5i |
| 956 |
\fBcommand\fR |
| 957 |
Use the Tcl proc specified by the \fB\-command\fR option to compare entries |
| 958 |
when sorting. If no command is specified, the sort reverts to |
| 959 |
\fBascii\fR sorting. |
| 960 |
.RE |
| 961 |
.RE |
| 962 |
.TP |
| 963 |
\fIpathName \fBsort once\fR ?\fIflags\fR? \fItagOrId...\fR |
| 964 |
Sorts the children for each entries specified by \fItagOrId\fR. |
| 965 |
By default, entries are sorted by name, but you can specify a |
| 966 |
Tcl proc to do your own comparisons. |
| 967 |
.RS |
| 968 |
.TP 1.5i |
| 969 |
\fB\-recurse\fR |
| 970 |
Recursively sort the entire branch, not just the children. |
| 971 |
.RE |
| 972 |
.RE |
| 973 |
.TP |
| 974 |
\fIpathName \fBtag \fIoperation args\fR |
| 975 |
Tags are a general means of selecting and marking nodes in the tree. |
| 976 |
A tag is just a string of characters, and it may take any form except |
| 977 |
that of an integer. The same tag may be associated with many |
| 978 |
different nodes. |
| 979 |
.sp |
| 980 |
Both \fIoperation\fR and its arguments determine the exact behavior of |
| 981 |
the command. The operations available for tags are listed below. |
| 982 |
.RS |
| 983 |
.TP |
| 984 |
\fIpathName\fR \fBtag add\fR \fIstring\fR \fIid\fR... |
| 985 |
Adds the tag \fIstring\fR to one of more entries. |
| 986 |
.TP |
| 987 |
\fIpathName\fR \fBtag delete\fR \fIstring\fR \fIid\fR... |
| 988 |
Deletes the tag \fIstring\fR from one or more entries. |
| 989 |
.TP |
| 990 |
\fIpathName\fR \fBtag forget\fR \fIstring\fR |
| 991 |
Removes the tag \fIstring\fR from all entries. It's not an error if no |
| 992 |
entries are tagged as \fIstring\fR. |
| 993 |
.TP |
| 994 |
\fIpathName\fR \fBtag names\fR ?\fIid\fR? |
| 995 |
Returns a list of tags used. If an \fIid\fR argument |
| 996 |
is present, only those tags used by the node designated by \fIid\fR |
| 997 |
are returned. |
| 998 |
.TP |
| 999 |
\fIpathName\fR \fBtag nodes\fR \fIstring\fR |
| 1000 |
Returns a list of ids that have the tag \fIstring\fR. If no node |
| 1001 |
is tagged as \fIstring\fR, then an empty string is returned. |
| 1002 |
.RE |
| 1003 |
.TP |
| 1004 |
\fIpathName \fBtext \fIoperation\fR ?\fIargs\fR? |
| 1005 |
This operation is used to provide text editing for cells (data |
| 1006 |
fields in a column) or entry labels. |
| 1007 |
It has several forms, depending on \fIoperation\fR: |
| 1008 |
.RS |
| 1009 |
.TP |
| 1010 |
\fIpathName \fBtext apply\fR |
| 1011 |
Applies the edited buffer, replacing the entry label |
| 1012 |
or data field. The edit window is hidden. |
| 1013 |
.TP |
| 1014 |
\fIpathName \fBtext cancel\fR |
| 1015 |
Cancels the editing operation, reverting the entry label |
| 1016 |
or data value back to the previous value. The edit window is hidden. |
| 1017 |
.TP |
| 1018 |
\fIpathName \fBtext cget\fI value\fR |
| 1019 |
Returns the current value of the configuration option given |
| 1020 |
by \fIoption\fR. |
| 1021 |
\fIOption\fR may have any of the values accepted by the \fBconfigure\fR |
| 1022 |
operation described below. |
| 1023 |
.TP |
| 1024 |
\fIpathName \fBtext configure\fR ?\fIoption value\fR? |
| 1025 |
Query or modify the configuration options of the edit window. |
| 1026 |
If no \fIoption\fR is specified, returns a list describing all of |
| 1027 |
the available options (see \fBTk_ConfigureInfo\fR for |
| 1028 |
information on the format of this list). If \fIoption\fR is specified |
| 1029 |
with no \fIvalue\fR, then the command returns a list describing the |
| 1030 |
one named option (this list will be identical to the corresponding |
| 1031 |
sublist of the value returned if no \fIoption\fR is specified). If |
| 1032 |
one or more \fIoption\-value\fR pairs are specified, then the command |
| 1033 |
modifies the given widget option(s) to have the given value(s); in |
| 1034 |
this case the command returns an empty string. |
| 1035 |
\fIOption\fR and \fIvalue\fR are described in the section |
| 1036 |
.SB "TEXT EDITING OPTIONS" |
| 1037 |
below. |
| 1038 |
.RE |
| 1039 |
.TP |
| 1040 |
\fIpathName \fBtext delete\fI first last\fR |
| 1041 |
Deletes the characters in the edit buffer between the two given |
| 1042 |
character positions. |
| 1043 |
.TP |
| 1044 |
\fIpathName \fBtext get\fR ?\fI\-root\fR? \fIx y\fR |
| 1045 |
.TP |
| 1046 |
\fIpathName \fBtext icursor\fI index\fR |
| 1047 |
.TP |
| 1048 |
\fIpathName \fBtext index\fI index\fR |
| 1049 |
Returns the text index of given \fIindex\fR. |
| 1050 |
.TP |
| 1051 |
\fIpathName \fBtext insert\fI index string\fR |
| 1052 |
Insert the text string \fIstring\fR into the edit buffer at the index |
| 1053 |
\fIindex\fR. For example, the index 0 will prepend the buffer. |
| 1054 |
.TP |
| 1055 |
\fIpathName \fBtext selection\fI args\fR |
| 1056 |
This operation controls the selection of the editing window. Note |
| 1057 |
that this differs from the selection of entries. |
| 1058 |
It has the following forms: |
| 1059 |
.RS |
| 1060 |
.TP |
| 1061 |
\fIpathName \fBtext selection adjust\fI index\fR |
| 1062 |
Adjusts either the first or last index of the selection. |
| 1063 |
.TP |
| 1064 |
\fIpathName \fBtext selection clear\fR |
| 1065 |
Clears the selection. |
| 1066 |
.TP |
| 1067 |
\fIpathName \fBtext selection from\fI index\fR |
| 1068 |
Sets the anchor of the selection. |
| 1069 |
.TP |
| 1070 |
\fIpathName \fBtext selection present\fR |
| 1071 |
Indicates if a selection is present. |
| 1072 |
.TP |
| 1073 |
\fIpathName \fBtext selection range\fI start end\fR |
| 1074 |
Sets both the anchor and mark of the selection. |
| 1075 |
.TP |
| 1076 |
\fIpathName \fBtext selection to\fI index\fR |
| 1077 |
Sets the unanchored end (mark) of the selection. |
| 1078 |
.RE |
| 1079 |
.TP |
| 1080 |
\fIpathName \fBtoggle \fItagOrId\fR |
| 1081 |
Opens or closes the node given by \fItagOrId\fR. If the corresponding |
| 1082 |
\fB\-opencommand\fR or \fB\-closecommand\fR option is set, then that |
| 1083 |
command is also invoked. |
| 1084 |
.TP |
| 1085 |
\fIpathName \fBxview \fIargs\fR |
| 1086 |
This command is used to query and change the horizontal position of the |
| 1087 |
information in the widget's window. It can take any of the following |
| 1088 |
forms: |
| 1089 |
.RS |
| 1090 |
.TP |
| 1091 |
\fIpathName \fBxview\fR |
| 1092 |
Returns a list containing two elements. |
| 1093 |
Each element is a real fraction between 0 and 1; together they describe |
| 1094 |
the horizontal span that is visible in the window. |
| 1095 |
For example, if the first element is .2 and the second element is .6, |
| 1096 |
20% of the \fBtreeview\fR widget's text is off-screen to the left, |
| 1097 |
the middle 40% is visible |
| 1098 |
in the window, and 40% of the text is off-screen to the right. |
| 1099 |
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR |
| 1100 |
option. |
| 1101 |
.TP |
| 1102 |
\fIpathName \fBxview\fR \fItagOrId\fR |
| 1103 |
Adjusts the view in the window so that the character position given by |
| 1104 |
\fItagOrId\fR is displayed at the left edge of the window. |
| 1105 |
Character positions are defined by the width of the character \fB0\fR. |
| 1106 |
.TP |
| 1107 |
\fIpathName \fBxview moveto\fI fraction\fR |
| 1108 |
Adjusts the view in the window so that \fIfraction\fR of the |
| 1109 |
total width of the \fBtreeview\fR widget's text is off-screen to the left. |
| 1110 |
\fIfraction\fR must be a fraction between 0 and 1. |
| 1111 |
.TP |
| 1112 |
\fIpathName \fBxview scroll \fInumber what\fR |
| 1113 |
This command shifts the view in the window left or right according to |
| 1114 |
\fInumber\fR and \fIwhat\fR. |
| 1115 |
\fINumber\fR must be an integer. |
| 1116 |
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation |
| 1117 |
of one of these. |
| 1118 |
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by |
| 1119 |
\fInumber\fR character units (the width of the \fB0\fR character) |
| 1120 |
on the display; if it is \fBpages\fR then the view adjusts by |
| 1121 |
\fInumber\fR screenfuls. |
| 1122 |
If \fInumber\fR is negative then characters farther to the left |
| 1123 |
become visible; if it is positive then characters farther to the right |
| 1124 |
become visible. |
| 1125 |
.RE |
| 1126 |
.TP |
| 1127 |
\fIpathName \fByview \fI?args\fR? |
| 1128 |
This command is used to query and change the vertical position of the |
| 1129 |
text in the widget's window. |
| 1130 |
It can take any of the following forms: |
| 1131 |
.RS |
| 1132 |
.TP |
| 1133 |
\fIpathName \fByview\fR |
| 1134 |
Returns a list containing two elements, both of which are real fractions |
| 1135 |
between 0 and 1. |
| 1136 |
The first element gives the position of the node at the |
| 1137 |
top of the window, relative to the widget as a whole (0.5 means |
| 1138 |
it is halfway through the treeview window, for example). |
| 1139 |
The second element gives the position of the node just after |
| 1140 |
the last one in the window, relative to the widget as a whole. |
| 1141 |
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR |
| 1142 |
option. |
| 1143 |
.TP |
| 1144 |
\fIpathName \fByview\fR \fItagOrId\fR |
| 1145 |
Adjusts the view in the window so that the node given by |
| 1146 |
\fItagOrId\fR is displayed at the top of the window. |
| 1147 |
.TP |
| 1148 |
\fIpathName \fByview moveto\fI fraction\fR |
| 1149 |
Adjusts the view in the window so that the node given by \fIfraction\fR |
| 1150 |
appears at the top of the window. |
| 1151 |
\fIFraction\fR is a fraction between 0 and 1; 0 indicates the first |
| 1152 |
node, 0.33 indicates the node one-third the |
| 1153 |
way through the \fBtreeview\fR widget, and so on. |
| 1154 |
.TP |
| 1155 |
\fIpathName \fByview scroll \fInumber what\fR |
| 1156 |
This command adjusts the view in the window up or down according to |
| 1157 |
\fInumber\fR and \fIwhat\fR. |
| 1158 |
\fINumber\fR must be an integer. |
| 1159 |
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR. |
| 1160 |
If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by |
| 1161 |
\fInumber\fR lines; if it is \fBpages\fR then |
| 1162 |
the view adjusts by \fInumber\fR screenfuls. |
| 1163 |
If \fInumber\fR is negative then earlier nodes |
| 1164 |
become visible; if it is positive then later nodes |
| 1165 |
become visible. |
| 1166 |
.RE |
| 1167 |
.SH "TREEVIEW OPTIONS" |
| 1168 |
In addition to the \fBconfigure\fR operation, widget configuration |
| 1169 |
options may also be set by the Tk \fBoption\fR command. The class |
| 1170 |
resource name is \fBTreeView\fR. |
| 1171 |
.CS |
| 1172 |
option add *TreeView.Foreground white |
| 1173 |
option add *TreeView.Background blue |
| 1174 |
.CE |
| 1175 |
The following widget options are available: |
| 1176 |
.TP |
| 1177 |
\fB\-activebackground \fIcolor\fR |
| 1178 |
Sets the background color for active entries. A node |
| 1179 |
is active when the mouse passes over it's entry or using the |
| 1180 |
\fBactivate\fR operation. |
| 1181 |
.TP |
| 1182 |
\fB\-activeforeground \fIcolor\fR |
| 1183 |
Sets the foreground color of the active node. A node |
| 1184 |
is active when the mouse passes over it's entry or using the |
| 1185 |
\fBactivate\fR operation. |
| 1186 |
.TP |
| 1187 |
\fB\-activeicons \fIimages\fR |
| 1188 |
Specifies images to be displayed for an entry's icon |
| 1189 |
when it is active. \fIImages\fR is a list of two Tk images: |
| 1190 |
the first image is displayed when the node is open, the |
| 1191 |
second when it is closed. |
| 1192 |
.TP |
| 1193 |
\fB\-autocreate \fIboolean\fR |
| 1194 |
If \fIboolean\fR is true, automatically create missing ancestor |
| 1195 |
nodes when inserting new nodes. Otherwise flag an error. |
| 1196 |
The default is \fBno\fR. |
| 1197 |
.TP |
| 1198 |
\fB\-allowduplicates \fIboolean\fR |
| 1199 |
If \fIboolean\fR is true, allow nodes with duplicate pathnames |
| 1200 |
when inserting new nodes. Otherwise flag an error. |
| 1201 |
The default is \fBno\fR. |
| 1202 |
.TP |
| 1203 |
\fB\-background \fIcolor\fR |
| 1204 |
Sets the background color of the widget. The default is \fBwhite\fR. |
| 1205 |
.TP |
| 1206 |
\fB\-borderwidth \fIpixels\fR |
| 1207 |
Sets the width of the 3\-D border around the outside edge of the widget. The |
| 1208 |
\fB\-relief\fR option determines if the border is to be drawn. The |
| 1209 |
default is \fB2\fR. |
| 1210 |
.TP |
| 1211 |
\fB\-closecommand \fIstring\fR |
| 1212 |
Specifies a Tcl script to be invoked when a node is closed. You can |
| 1213 |
overrider this for individual entries using the entry's \fB\-closecommand\fR |
| 1214 |
option. The default is \fB""\fR. |
| 1215 |
Percent substitutions are performed on \fIstring\fR before |
| 1216 |
it is executed. The following substitutions are valid: |
| 1217 |
.RS |
| 1218 |
.TP 5 |
| 1219 |
\fB%W\fR |
| 1220 |
The pathname of the widget. |
| 1221 |
.TP 5 |
| 1222 |
\fB%p\fR |
| 1223 |
The name of the node. |
| 1224 |
.TP 5 |
| 1225 |
\fB%P\fR |
| 1226 |
The full pathname of the node. |
| 1227 |
.TP 5 |
| 1228 |
\fB%#\fR |
| 1229 |
The id of the node. |
| 1230 |
.TP 5 |
| 1231 |
\fB%%\fR |
| 1232 |
Translates to a single percent. |
| 1233 |
.RE |
| 1234 |
.TP |
| 1235 |
\fB\-cursor \fIcursor\fR |
| 1236 |
Specifies the widget's cursor. The default cursor is \fB""\fR. |
| 1237 |
.TP |
| 1238 |
\fB\-dashes \fInumber\fR |
| 1239 |
Sets the dash style of the horizontal and vertical lines drawn connecting |
| 1240 |
entries. \fINumber\fR is the length in pixels of the dashes and gaps in |
| 1241 |
the line. If \fInumber\fR is \fB0\fR, solid lines will |
| 1242 |
be drawn. The default is \fB1\fR (dotted). |
| 1243 |
.TP |
| 1244 |
\fB\-exportselection \fIboolean\fR |
| 1245 |
Indicates if the selection is exported. If the widget is exporting its |
| 1246 |
selection then it will observe the standard X11 protocols for handling |
| 1247 |
the selection. Selections are available as type \fBSTRING\fR; |
| 1248 |
the value of the selection will be the label of the selected nodes, |
| 1249 |
separated by newlines. The default is \fBno\fR. |
| 1250 |
.TP |
| 1251 |
\fB\-flat \fIboolean\fR |
| 1252 |
Indicates whether to display the tree as a flattened list. |
| 1253 |
If \fIboolean\fR is true, then the hierarchy will be a list of full |
| 1254 |
paths for the nodes. This option also has affect on sorting. |
| 1255 |
See the |
| 1256 |
.SB "SORT OPERATIONS" |
| 1257 |
section for more information. |
| 1258 |
The default is \fBno\fR. |
| 1259 |
.TP |
| 1260 |
\fB\-focusdashes \fIdashList\fR |
| 1261 |
Sets the dash style of the outline rectangle drawn around the entry |
| 1262 |
label of the node that current has focus. \fINumber\fR is the length |
| 1263 |
in pixels of the dashes and gaps in the line. If |
| 1264 |
\fInumber\fR is \fB0\fR, a solid line will be drawn. The default is |
| 1265 |
\fB1\fR. |
| 1266 |
.TP |
| 1267 |
\fB\-focusforeground \fIcolor\fR |
| 1268 |
Sets the color of the focus rectangle. |
| 1269 |
The default is \fBblack\fR. |
| 1270 |
.TP |
| 1271 |
\fB\-font \fIfontName\fR |
| 1272 |
Specifies the font for entry labels. You can override this for individual |
| 1273 |
entries with the entry's \fB\-font\fR configuration option. The default is |
| 1274 |
\fB*-Helvetica-Bold-R-Normal-*-12-120-*\fR. |
| 1275 |
.TP |
| 1276 |
\fB\-foreground \fIcolor\fR |
| 1277 |
Sets the text color of entry labels. You can override this for individual |
| 1278 |
entries with the entry's \fB\-foreground\fR configuration option. |
| 1279 |
The default is |
| 1280 |
\fBblack\fR. |
| 1281 |
.TP |
| 1282 |
\fB\-height \fIpixels\fR |
| 1283 |
Specifies the requested height of widget. The default is |
| 1284 |
\fB400\fR. |
| 1285 |
.TP |
| 1286 |
\fB\-hideroot \fIboolean\fR |
| 1287 |
If \fIboolean\fR is true, it indicates that no entry for the root node |
| 1288 |
should be displayed. The default is \fBno\fR. |
| 1289 |
.TP |
| 1290 |
\fB\-highlightbackground \fIcolor\fR |
| 1291 |
Specifies the normal color of the traversal highlight region when |
| 1292 |
the widget does not have the input focus. |
| 1293 |
.TP |
| 1294 |
\fB\-highlightcolor \fIcolor\fR |
| 1295 |
Specifies the color of the traversal highlight rectangle when |
| 1296 |
the widget has the input focus. |
| 1297 |
The default is \fBblack\fR. |
| 1298 |
.TP |
| 1299 |
\fB\-highlightthickness \fIpixels\fR |
| 1300 |
Specifies the width of the highlight rectangle indicating when the |
| 1301 |
widget has input focus. The value may have any of the forms acceptable |
| 1302 |
to \fBTk_GetPixels\fR. If the value is zero, no focus highlight will |
| 1303 |
be displayed. The default is \fB2\fR. |
| 1304 |
.TP |
| 1305 |
\fB\-icons \fIimages\fR |
| 1306 |
Specifies images for the entry's icon. |
| 1307 |
\fIImages\fR is a list of two Tk images: |
| 1308 |
the first image is displayed when the node is open, the |
| 1309 |
second when it is closed. |
| 1310 |
.TP |
| 1311 |
\fB\-linecolor \fIcolor\fR |
| 1312 |
Sets the color of the connecting lines drawn between entries. |
| 1313 |
The default is \fBblack\fR. |
| 1314 |
.TP |
| 1315 |
\fB\-linespacing \fIpixels\fR |
| 1316 |
Sets the number of pixels spacing between entries. |
| 1317 |
The default is \fB0\fR. |
| 1318 |
.TP |
| 1319 |
\fB\-linewidth \fIpixels\fR |
| 1320 |
Set the width of the lines drawn connecting entries. If \fIpixels\fR |
| 1321 |
is \fB0\fR, no vertical or horizontal lines are drawn. |
| 1322 |
The default is \fB1\fR. |
| 1323 |
.TP |
| 1324 |
\fB\-opencommand \fIstring\fR |
| 1325 |
Specifies a Tcl script to be invoked when a node is open. |
| 1326 |
You can override this for individual entries with the entry's |
| 1327 |
\fB\-opencommand\fR configuration option. The default is \fB""\fR. |
| 1328 |
Percent substitutions are performed on \fIstring\fR before |
| 1329 |
it is executed. The following substitutions are valid: |
| 1330 |
.RS |
| 1331 |
.TP 5 |
| 1332 |
\fB%W\fR |
| 1333 |
The pathname of the widget. |
| 1334 |
.TP 5 |
| 1335 |
\fB%p\fR |
| 1336 |
The name of the node. |
| 1337 |
.TP 5 |
| 1338 |
\fB%P\fR |
| 1339 |
The full pathname of the node. |
| 1340 |
.TP 5 |
| 1341 |
\fB%#\fR |
| 1342 |
The id of the node. |
| 1343 |
.TP 5 |
| 1344 |
\fB%%\fR |
| 1345 |
Translates to a single percent. |
| 1346 |
.RE |
| 1347 |
.TP |
| 1348 |
\fB\-relief \fIrelief\fR |
| 1349 |
Specifies the 3-D effect for the widget. \fIRelief\fR |
| 1350 |
specifies how the \fBtreeview\fR widget should appear relative to widget |
| 1351 |
it is packed into; for example, \fBraised\fR means the \fBtreeview\fR widget |
| 1352 |
should appear to protrude. The default is \fBsunken\fR. |
| 1353 |
.TP |
| 1354 |
\fB\-scrollmode \fImode\fR |
| 1355 |
Specifies the style of scrolling to be used. The following |
| 1356 |
styles are valid. This is the default is \fBhierbox\fR. |
| 1357 |
.RS |
| 1358 |
.TP 1.25i |
| 1359 |
\fBlistbox\fR |
| 1360 |
Like the \fBlistbox\fR widget, the last entry can always be |
| 1361 |
scrolled to the top of the widget window. This allows the scrollbar |
| 1362 |
thumb to shrink as the last entry is scrolled upward. |
| 1363 |
.TP 1.25i |
| 1364 |
\fBhierbox\fR |
| 1365 |
Like the \fBhierbox\fR widget, the last entry can only be |
| 1366 |
viewed at the bottom of the widget window. The scrollbar |
| 1367 |
stays a constant size. |
| 1368 |
.TP 1.25i |
| 1369 |
\fBcanvas\fR |
| 1370 |
Like the \fBcanvas\fR widget, the entries are bound within |
| 1371 |
the scrolling area. |
| 1372 |
.RE |
| 1373 |
.TP |
| 1374 |
\fB\-selectbackground \fIcolor\fR |
| 1375 |
Sets the background color selected node entries. |
| 1376 |
The default is \fB#ffffea\fR. |
| 1377 |
.TP |
| 1378 |
\fB\-selectborderwidth \fIpixels\fR |
| 1379 |
Sets the width of the raised 3-D border drawn around the labels |
| 1380 |
of selected entries. The default is \fB0\fR. |
| 1381 |
\fB\-selectcommand \fIstring\fR |
| 1382 |
Specifies a Tcl script to invoked when the set of selected |
| 1383 |
nodes changes. |
| 1384 |
The default is \fB""\fR. |
| 1385 |
.TP |
| 1386 |
\fB\-selectforeground \fIcolor\fB |
| 1387 |
Sets the color of the labels of selected node entries. |
| 1388 |
The default is \fBblack\fR. |
| 1389 |
.TP |
| 1390 |
\fB\-selectmode \fImode\fR |
| 1391 |
Specifies the selection mode. If \fImode\fR is |
| 1392 |
\fBsingle\fR, only one node can be selected |
| 1393 |
at a time. If \fBmultiple\fR more than one |
| 1394 |
node can be selected. |
| 1395 |
The default is \fBsingle\fR. |
| 1396 |
.TP |
| 1397 |
\fB\-separator \fIstring\fR |
| 1398 |
Specifies the character sequence to use when spliting the path components. |
| 1399 |
The separator may be several characters wide (such as "::") |
| 1400 |
Consecutive separators in a pathname are treated as one. |
| 1401 |
If \fIstring\fR is the empty string, the pathnames are Tcl lists. |
| 1402 |
Each element is a path component. The default is \fB""\fR. |
| 1403 |
.TP |
| 1404 |
\fB\-showtitles \fIboolean\fR |
| 1405 |
If \fIboolean\fR is false, column titles are not be displayed. |
| 1406 |
The default is \fByes\fR. |
| 1407 |
.TP |
| 1408 |
\fB\-sortselection \fIboolean\fR |
| 1409 |
If \fIboolean\fR is true, nodes in the selection are ordered as they |
| 1410 |
are currently displayed (depth-first or sorted), not in the order |
| 1411 |
they were selected. The default is \fBno\fR. |
| 1412 |
.TP |
| 1413 |
\fB\-takefocus\fR \fIfocus\fR |
| 1414 |
Provides information used when moving the focus from window to window |
| 1415 |
via keyboard traversal (e.g., Tab and Shift-Tab). If \fIfocus\fR is |
| 1416 |
\fB0\fR, this means that this window should be skipped entirely during |
| 1417 |
keyboard traversal. \fB1\fR means that the this window should always |
| 1418 |
receive the input focus. An empty value means that the traversal |
| 1419 |
scripts make the decision whether to focus on the window. |
| 1420 |
The default is \fB"1"\fR. |
| 1421 |
.TP |
| 1422 |
\fB\-trim \fIstring\fR |
| 1423 |
Specifies a string leading characters to trim from entry pathnames |
| 1424 |
before parsing. This only makes sense if the \fB\-separator\fR is also |
| 1425 |
set. The default is \fB""\fR. |
| 1426 |
.TP |
| 1427 |
\fB\-width \fIpixels\fR |
| 1428 |
Sets the requested width of the widget. If \fIpixels\fR is 0, then |
| 1429 |
the with is computed from the contents of the \fBtreeview\fR widget. |
| 1430 |
The default is \fB200\fR. |
| 1431 |
.TP |
| 1432 |
\fB\-xscrollcommand \fIstring\fR |
| 1433 |
Specifies the prefix for a command used to communicate with horizontal |
| 1434 |
scrollbars. Whenever the horizontal view in the widget's window |
| 1435 |
changes, the widget will generate a Tcl command by concatenating the |
| 1436 |
scroll command and two numbers. If this option is not specified, then |
| 1437 |
no command will be executed. |
| 1438 |
.TP |
| 1439 |
\fB\-xscrollincrement\fR \fIpixels\fR |
| 1440 |
Sets the horizontal scrolling distance. The default is 20 pixels. |
| 1441 |
.TP |
| 1442 |
\fB\-yscrollcommand \fIstring\fR |
| 1443 |
Specifies the prefix for a command used to communicate with vertical |
| 1444 |
scrollbars. Whenever the vertical view in the widget's window |
| 1445 |
changes, the widget will generate a Tcl command by concatenating the |
| 1446 |
scroll command and two numbers. If this option is not specified, then |
| 1447 |
no command will be executed. |
| 1448 |
.TP |
| 1449 |
\fB\-yscrollincrement\fR \fIpixels\fR |
| 1450 |
Sets the vertical scrolling distance. The default is 20 pixels. |
| 1451 |
.SH "ENTRY OPTIONS" |
| 1452 |
Many widget configuration options have counterparts in entries. For |
| 1453 |
example, there is a \fB\-closecommand\fR configuration option for both |
| 1454 |
widget itself and for individual entries. Options set at the widget |
| 1455 |
level are global for all entries. If the entry configuration option |
| 1456 |
is set, then it overrides the widget option. This is done to avoid |
| 1457 |
wasting memory by replicated options. Most entries will have |
| 1458 |
redundant options. |
| 1459 |
.PP |
| 1460 |
There is no resource class or name for entries. |
| 1461 |
.TP |
| 1462 |
\fB\-activeicons \fIimages\fR |
| 1463 |
Specifies images to be displayed as the entry's icon |
| 1464 |
when it is active. This overrides the global \fB\-activeicons\fR |
| 1465 |
configuration option for the specific entry. |
| 1466 |
\fIImages\fR is a list of two Tk images: |
| 1467 |
the first image is displayed when the node is open, the |
| 1468 |
second when it is closed. |
| 1469 |
.TP |
| 1470 |
\fB\-bindtags \fItagList\fR |
| 1471 |
Specifies the binding tags for nodes. \fITagList\fR is a list |
| 1472 |
of binding tag names. The tags and their order will determine how |
| 1473 |
events are handled for nodes. Each tag in the list matching the current |
| 1474 |
event sequence will have its Tcl command executed. The default value |
| 1475 |
is \fBall\fR. |
| 1476 |
.TP |
| 1477 |
\fB\-button \fIstring\fR |
| 1478 |
Indicates whether a button should be displayed on the left side |
| 1479 |
of the node entry. \fIString\fR can be \fByes\fR, \fBno\fR, |
| 1480 |
or \fBauto\fR. If \fBauto\fR, then a button is automatically |
| 1481 |
displayed if the node has children. This is the default. |
| 1482 |
.TP |
| 1483 |
\fB\-closecommand \fIstring\fR |
| 1484 |
Specifies a Tcl script to be invoked when the node is closed. This |
| 1485 |
overrides the global \fB\-closecommand\fR option for this entry. |
| 1486 |
The default is \fB""\fR. |
| 1487 |
Percent substitutions are performed on \fIstring\fR before |
| 1488 |
it is executed. The following substitutions are valid: |
| 1489 |
.RS |
| 1490 |
.TP 5 |
| 1491 |
\fB%W\fR |
| 1492 |
The pathname of the widget. |
| 1493 |
.TP 5 |
| 1494 |
\fB%p\fR |
| 1495 |
The name of the node. |
| 1496 |
.TP 5 |
| 1497 |
\fB%P\fR |
| 1498 |
The full pathname of the node. |
| 1499 |
.TP 5 |
| 1500 |
\fB%#\fR |
| 1501 |
The id of the node. |
| 1502 |
.TP 5 |
| 1503 |
\fB%%\fR |
| 1504 |
Translates to a single percent. |
| 1505 |
.RE |
| 1506 |
.TP |
| 1507 |
\fB\-data \fIstring\fR |
| 1508 |
Sets data fields for the node. \fIString\fR is a list of |
| 1509 |
name-value pairs to be set. The default is \fB""\fR. |
| 1510 |
.TP |
| 1511 |
\fB\-font \fIfontName\fR |
| 1512 |
Sets the font for entry labels. This overrides the widget's |
| 1513 |
\fB\-font\fR option for this node. The default is |
| 1514 |
\fB*-Helvetica-Bold-R-Normal-*-12-120-*\fR. |
| 1515 |
.TP |
| 1516 |
\fB\-foreground \fIcolor\fR |
| 1517 |
Sets the text color of the entry label. This overrides the widget's |
| 1518 |
\fB\-foreground\fR configuration option. The default is \fB""\fR. |
| 1519 |
.TP |
| 1520 |
\fB\-icons \fIimages\fR |
| 1521 |
Specifies images to be displayed for the entry's icon. |
| 1522 |
This overrides the global \fB\-icons\fR configuration option. |
| 1523 |
\fIImages\fR is a list of two Tk images: |
| 1524 |
the first image is displayed when the node is open, the |
| 1525 |
second when it is closed. |
| 1526 |
.TP |
| 1527 |
\fB\-label \fIstring\fR |
| 1528 |
Sets the text for the entry's label. If not set, this |
| 1529 |
defaults to the name of the node. The default is \fB""\fR. |
| 1530 |
.TP |
| 1531 |
\fB\-opencommand \fIstring\fR |
| 1532 |
Specifies a Tcl script to be invoked when the entry is opened. |
| 1533 |
This overrides the widget's \fB\-opencommand\fR option for this node. |
| 1534 |
The default is \fB""\fR. |
| 1535 |
Percent substitutions are performed on \fIstring\fR before |
| 1536 |
it is executed. The following substitutions are valid: |
| 1537 |
.RS |
| 1538 |
.TP 5 |
| 1539 |
\fB%W\fR |
| 1540 |
The pathname of the widget. |
| 1541 |
.TP 5 |
| 1542 |
\fB%p\fR |
| 1543 |
The name of the node. |
| 1544 |
.TP 5 |
| 1545 |
\fB%P\fR |
| 1546 |
The full pathname of the node. |
| 1547 |
.TP 5 |
| 1548 |
\fB%#\fR |
| 1549 |
The id of the node. |
| 1550 |
.TP 5 |
| 1551 |
\fB%%\fR |
| 1552 |
Translates to a single percent. |
| 1553 |
.RE |
| 1554 |
.SH "BUTTON OPTIONS" |
| 1555 |
Button configuration options may also be set by the \fBoption\fR command. |
| 1556 |
The resource subclass is \fBButton\fR. The resource name is always |
| 1557 |
\fBbutton\fR. |
| 1558 |
.CS |
| 1559 |
option add *TreeView.Button.Foreground white |
| 1560 |
option add *TreeView.button.Background blue |
| 1561 |
.CE |
| 1562 |
The following are the configuration options available for buttons. |
| 1563 |
.TP |
| 1564 |
\fB\-activebackground \fIcolor\fR |
| 1565 |
Sets the background color of active buttons. A button |
| 1566 |
is made active when the mouse passes over it or by the |
| 1567 |
\fBbutton activate\fR operation. |
| 1568 |
.TP |
| 1569 |
\fB\-activeforeground \fIcolor\fR |
| 1570 |
Sets the foreground color of active buttons. A button |
| 1571 |
is made active when the mouse passes over it or by the |
| 1572 |
\fBbutton activate\fR operation. |
| 1573 |
.TP |
| 1574 |
\fB\-background \fIcolor\fR |
| 1575 |
Sets the background of the button. The default is \fBwhite\fR. |
| 1576 |
.TP |
| 1577 |
\fB\-borderwidth \fIpixels\fR |
| 1578 |
Sets the width of the 3\-D border around the button. |
| 1579 |
The \fB\-relief\fR option determines if a border is to be drawn. The |
| 1580 |
default is \fB1\fR. |
| 1581 |
.TP |
| 1582 |
\fB\-closerelief \fIrelief\fR |
| 1583 |
Specifies the 3-D effect for the closed button. \fIRelief\fR |
| 1584 |
indicates how the button should appear relative to the widget; |
| 1585 |
for example, \fBraised\fR means the button should |
| 1586 |
appear to protrude. The default is \fBsolid\fR. |
| 1587 |
.TP |
| 1588 |
\fB\-cursor \fIcursor\fR |
| 1589 |
Sets the widget's cursor. The default cursor is \fB""\fR. |
| 1590 |
.TP |
| 1591 |
\fB\-foreground \fIcolor\fR |
| 1592 |
Sets the foreground color of buttons. |
| 1593 |
The default is \fBblack\fR. |
| 1594 |
.TP |
| 1595 |
\fB\-images \fIimages\fR |
| 1596 |
Specifies images to be displayed for the button. |
| 1597 |
\fIImages\fR is a list of two Tk images: |
| 1598 |
the first image is displayed when the button is open, the |
| 1599 |
second when it is closed. If the \fIimages\fR is the empty string, |
| 1600 |
then a plus/minus gadget is drawn. The default is \fB""\fR. |
| 1601 |
.TP |
| 1602 |
\fB\-openrelief \fIrelief\fR |
| 1603 |
Specifies the 3-D effect of the open button. \fIRelief\fR |
| 1604 |
indicates how the button should appear relative to the widget; |
| 1605 |
for example, \fBraised\fR means the button should |
| 1606 |
appear to protrude. The default is \fBflat\fR. |
| 1607 |
.TP |
| 1608 |
\fB\-size \fIpixels\fR |
| 1609 |
Sets the requested size of the button. |
| 1610 |
The default is \fB0\fR. |
| 1611 |
.RE |
| 1612 |
.SH "COLUMN OPTIONS" |
| 1613 |
Column configuration options may also be set by the \fBoption\fR command. |
| 1614 |
The resource subclass is \fBColumn\fR. The resource name is the |
| 1615 |
name of the column. |
| 1616 |
.CS |
| 1617 |
option add *TreeView.Column.Foreground white |
| 1618 |
option add *TreeView.treeView.Background blue |
| 1619 |
.CE |
| 1620 |
The following configuration options are available for columns. |
| 1621 |
.TP |
| 1622 |
\fB\-background \fIcolor\fR |
| 1623 |
Sets the background color of the column. This overrides |
| 1624 |
the widget's \fB\-background\fR option. The default is \fBwhite\fR. |
| 1625 |
.TP |
| 1626 |
\fB\-borderwidth \fIpixels\fR |
| 1627 |
Sets the width of the 3\-D border of the column. |
| 1628 |
The \fB\-relief\fR option determines if a border is to be drawn. The |
| 1629 |
default is \fB0\fR. |
| 1630 |
.TP |
| 1631 |
\fB\-edit \fIboolean\fR |
| 1632 |
Indicates if the column's data fields can be edited. If \fIboolean\fR is |
| 1633 |
false, the data fields in the column may not be edited. |
| 1634 |
The default is \fByes\fR. |
| 1635 |
.TP |
| 1636 |
\fB\-foreground \fIcolor\fR |
| 1637 |
Specifies the foreground color of the column. |
| 1638 |
You can override this for individual entries with the entry's |
| 1639 |
\fB\-foreground\fR option. |
| 1640 |
The default is \fBblack\fR. |
| 1641 |
.TP |
| 1642 |
\fB\-font \fIfontName\fR |
| 1643 |
Sets the font for a column. You can override this for individual entries |
| 1644 |
with the entry's \fB\-font\fR option. The default is |
| 1645 |
\fB*-Helvetica-Bold-R-Normal-*-12-120-*\fR. |
| 1646 |
.TP |
| 1647 |
\fB\-hide \fIboolean\fR |
| 1648 |
If \fIboolean\fR is true, the column is not displayed. |
| 1649 |
The default is \fByes\fR. |
| 1650 |
.TP |
| 1651 |
\fB\-justify \fIjustify\fR |
| 1652 |
Specifies how the column data fields title should be justified within |
| 1653 |
the column. This matters only when the column is wider than the |
| 1654 |
data field to be display. |
| 1655 |
\fIJustify\fR must be \fBleft\fR, \fBright\fR, or \fBcenter\fR. |
| 1656 |
The default is \fBleft\fR. |
| 1657 |
.TP |
| 1658 |
\fB\-pad \fIpad\fR |
| 1659 |
Specifies how much padding for the left and right sides of the column. |
| 1660 |
\fIPad\fR is a list of one or two screen distances. If \fIpad\fR |
| 1661 |
has two elements, the left side of the column is padded by the first |
| 1662 |
distance and the right side by the second. If \fIpad\fR has just one |
| 1663 |
distance, both the left and right sides are padded evenly. The |
| 1664 |
default is \fB2\fR. |
| 1665 |
.TP |
| 1666 |
\fB\-relief \fIrelief\fR |
| 1667 |
Specifies the 3-D effect of the column. \fIRelief\fR |
| 1668 |
specifies how the column should appear relative to the widget; |
| 1669 |
for example, \fBraised\fR means the column should |
| 1670 |
appear to protrude. The default is \fBflat\fR. |
| 1671 |
.TP |
| 1672 |
\fB\-state \fIstate\fR |
| 1673 |
Sets the state of the column. If \fIstate\fR is \fBdisable\fR then |
| 1674 |
the column title can not be activated nor invoked. |
| 1675 |
The default is \fBnormal\fR. |
| 1676 |
.TP |
| 1677 |
\fB\-text \fIstring\fR |
| 1678 |
Sets the title for the column. |
| 1679 |
The default is \fB""\fR. |
| 1680 |
.TP |
| 1681 |
\fB\-titleforeground \fIcolor\fR |
| 1682 |
Sets the foreground color of the column title. |
| 1683 |
The default is \fBblack\fR. |
| 1684 |
.TP |
| 1685 |
\fB\-titleshadow \fIcolor\fR |
| 1686 |
Sets the color of the drop shadow of the column title. |
| 1687 |
The default is \fB""\fR. |
| 1688 |
.TP |
| 1689 |
\fB\-width \fIpixels\fR |
| 1690 |
Sets the requested width of the column. This overrides |
| 1691 |
the computed with of the column. If \fIpixels\fR is 0, |
| 1692 |
the width is computed as from the contents of the column. The |
| 1693 |
default is \fB0\fR. |
| 1694 |
.RE |
| 1695 |
.SH "TEXT EDITING OPTIONS" |
| 1696 |
Text edit window configuration options may also be set by the |
| 1697 |
\fBoption\fR command. The resource class is \fBTreeViewEditor\fR. |
| 1698 |
The resource name is always \fBedit\fR. |
| 1699 |
.CS |
| 1700 |
option add *TreeViewEditor.Foreground white |
| 1701 |
option add *edit.Background blue |
| 1702 |
.CE |
| 1703 |
The following are the configuration options available for the |
| 1704 |
text editing window. |
| 1705 |
.TP |
| 1706 |
\fB\-background \fIcolor\fR |
| 1707 |
Sets the background of the text edit window. The default is \fBwhite\fR. |
| 1708 |
.TP |
| 1709 |
\fB\-borderwidth \fIpixels\fR |
| 1710 |
Sets the width of the 3\-D border around the edit window. |
| 1711 |
The \fB\-relief\fR option determines if a border is to be drawn. The |
| 1712 |
default is \fB1\fR. |
| 1713 |
.TP |
| 1714 |
\fB\-exportselection \fIboolean\fR |
| 1715 |
Indicates if the text selection is exported. If the edit window is |
| 1716 |
exporting its selection then it will observe the standard X11 protocols |
| 1717 |
for handling the selection. Selections are available as type \fBSTRING\fR. |
| 1718 |
The default is \fBno\fR. |
| 1719 |
.TP |
| 1720 |
\fB\-relief \fIrelief\fR |
| 1721 |
Specifies the 3-D effect of the edit window. \fIRelief\fR |
| 1722 |
indicates how the background should appear relative to the edit |
| 1723 |
window; for example, \fBraised\fR means the background should |
| 1724 |
appear to protrude. The default is \fBsolid\fR. |
| 1725 |
.TP |
| 1726 |
\fB\-selectbackground \fIcolor\fR |
| 1727 |
Sets the background of the selected text in the edit window. |
| 1728 |
The default is \fBwhite\fR. |
| 1729 |
.TP |
| 1730 |
\fB\-selectborderwidth \fIpixels\fR |
| 1731 |
Sets the width of the 3\-D border around the selected text in the |
| 1732 |
edit window. The \fB\-selectrelief\fR option determines if a border |
| 1733 |
is to be drawn. The default is \fB1\fR. |
| 1734 |
.TP |
| 1735 |
\fB\-selectforeground \fIcolor\fR |
| 1736 |
Sets the foreground of the selected text in the edit window. |
| 1737 |
The default is \fBwhite\fR. |
| 1738 |
.TP |
| 1739 |
\fB\-selectrelief \fIrelief\fR |
| 1740 |
Specifies the 3-D effect of the selected text in the edit window. |
| 1741 |
\fIRelief\fR indicates how the text should appear relative to the edit |
| 1742 |
window; for example, \fBraised\fR means the text should |
| 1743 |
appear to protrude. The default is \fBflat\fR. |
| 1744 |
.RE |
| 1745 |
.SH "DEFAULT BINDINGS" |
| 1746 |
Tk automatically creates class bindings for treeviews that give them |
| 1747 |
Motif-like behavior. Much of the behavior of a \fBtreeview\fR widget is determined |
| 1748 |
by its \fB\-selectmode\fR option, which selects one of two ways |
| 1749 |
of dealing with the selection. |
| 1750 |
.PP |
| 1751 |
If the selection mode is \fBsingle\fR, only one node can be |
| 1752 |
selected at a time. |
| 1753 |
Clicking button 1 on an node selects |
| 1754 |
it and deselects any other selected item. |
| 1755 |
.PP |
| 1756 |
If the selection mode is \fBmultiple\fR, |
| 1757 |
any number of entries may be selected at once, including discontiguous |
| 1758 |
ranges. Clicking Control-Button-1 on a node entry |
| 1759 |
toggles its selection state without affecting any other entries. |
| 1760 |
Pressing Shift-Button-1 on a node entry selects |
| 1761 |
it, extends the selection. |
| 1762 |
.IP [1] |
| 1763 |
In \fBextended\fR mode, the selected range can be adjusted by pressing |
| 1764 |
button 1 with the Shift key down: this modifies the selection to |
| 1765 |
consist of the entries between the anchor and the entry under |
| 1766 |
the mouse, inclusive. |
| 1767 |
The un-anchored end of this new selection can also be dragged with |
| 1768 |
the button down. |
| 1769 |
.IP [2] |
| 1770 |
In \fBextended\fR mode, pressing button 1 with the Control key down |
| 1771 |
starts a toggle operation: the anchor is set to the entry under |
| 1772 |
the mouse, and its selection state is reversed. The selection state |
| 1773 |
of other entries isn't changed. |
| 1774 |
If the mouse is dragged with button 1 down, then the selection state |
| 1775 |
of all entries between the anchor and the entry under the mouse |
| 1776 |
is set to match that of the anchor entry; the selection state of |
| 1777 |
all other entries remains what it was before the toggle operation |
| 1778 |
began. |
| 1779 |
.IP [3] |
| 1780 |
If the mouse leaves the treeview window with button 1 down, the window |
| 1781 |
scrolls away from the mouse, making information visible that used |
| 1782 |
to be off-screen on the side of the mouse. |
| 1783 |
The scrolling continues until the mouse re-enters the window, the |
| 1784 |
button is released, or the end of the hierarchy is reached. |
| 1785 |
.IP [4] |
| 1786 |
Mouse button 2 may be used for scanning. |
| 1787 |
If it is pressed and dragged over the \fBtreeview\fR widget, the contents of |
| 1788 |
the hierarchy drag at high speed in the direction the mouse moves. |
| 1789 |
.IP [5] |
| 1790 |
If the Up or Down key is pressed, the location cursor (active |
| 1791 |
entry) moves up or down one entry. |
| 1792 |
If the selection mode is \fBbrowse\fR or \fBextended\fR then the |
| 1793 |
new active entry is also selected and all other entries are |
| 1794 |
deselected. |
| 1795 |
In \fBextended\fR mode the new active entry becomes the |
| 1796 |
selection anchor. |
| 1797 |
.IP [6] |
| 1798 |
In \fBextended\fR mode, Shift-Up and Shift-Down move the location |
| 1799 |
cursor (active entry) up or down one entry and also extend |
| 1800 |
the selection to that entry in a fashion similar to dragging |
| 1801 |
with mouse button 1. |
| 1802 |
.IP [7] |
| 1803 |
The Left and Right keys scroll the \fBtreeview\fR widget view left and right |
| 1804 |
by the width of the character \fB0\fR. |
| 1805 |
Control-Left and Control-Right scroll the \fBtreeview\fR widget view left and |
| 1806 |
right by the width of the window. |
| 1807 |
Control-Prior and Control-Next also scroll left and right by |
| 1808 |
the width of the window. |
| 1809 |
.IP [8] |
| 1810 |
The Prior and Next keys scroll the \fBtreeview\fR widget view up and down |
| 1811 |
by one page (the height of the window). |
| 1812 |
.IP [9] |
| 1813 |
The Home and End keys scroll the \fBtreeview\fR widget horizontally to |
| 1814 |
the left and right edges, respectively. |
| 1815 |
.IP [10] |
| 1816 |
Control-Home sets the location cursor to the the first entry, |
| 1817 |
selects that entry, and deselects everything else |
| 1818 |
in the widget. |
| 1819 |
.IP [11] |
| 1820 |
Control-End sets the location cursor to the the last entry, |
| 1821 |
selects that entry, and deselects everything else |
| 1822 |
in the widget. |
| 1823 |
.IP [12] |
| 1824 |
In \fBextended\fR mode, Control-Shift-Home extends the selection |
| 1825 |
to the first entry and Control-Shift-End extends |
| 1826 |
the selection to the last entry. |
| 1827 |
.IP [13] |
| 1828 |
In \fBmultiple\fR mode, Control-Shift-Home moves the location cursor |
| 1829 |
to the first entry and Control-Shift-End moves |
| 1830 |
the location cursor to the last entry. |
| 1831 |
.IP [14] |
| 1832 |
The space and Select keys make a selection at the location cursor |
| 1833 |
(active entry) just as if mouse button 1 had been pressed over |
| 1834 |
this entry. |
| 1835 |
.IP [15] |
| 1836 |
In \fBextended\fR mode, Control-Shift-space and Shift-Select |
| 1837 |
extend the selection to the active entry just as if button 1 |
| 1838 |
had been pressed with the Shift key down. |
| 1839 |
.IP [16] |
| 1840 |
In \fBextended\fR mode, the Escape key cancels the most recent |
| 1841 |
selection and restores all the entries in the selected range |
| 1842 |
to their previous selection state. |
| 1843 |
.IP [17] |
| 1844 |
Control-slash selects everything in the widget, except in |
| 1845 |
\fBsingle\fR and \fBbrowse\fR modes, in which case it selects |
| 1846 |
the active entry and deselects everything else. |
| 1847 |
.IP [18] |
| 1848 |
Control-backslash deselects everything in the widget, except in |
| 1849 |
\fBbrowse\fR mode where it has no effect. |
| 1850 |
.IP [19] |
| 1851 |
The F16 key (labelled Copy on many Sun workstations) or Meta-w |
| 1852 |
copies the selection in the widget to the clipboard, if there is |
| 1853 |
a selection. |
| 1854 |
.PP |
| 1855 |
The behavior of \fBtreeview\fR widgets can be changed by defining new bindings |
| 1856 |
for individual widgets or by redefining the class bindings. |
| 1857 |
.SS WIDGET BINDINGS |
| 1858 |
In addition to the above behavior, the following additional behavior |
| 1859 |
is defined by the default widget class (TreeView) bindings. |
| 1860 |
.IP \fB<ButtonPress-2>\fR |
| 1861 |
Starts scanning. |
| 1862 |
.IP \fB<B2-Motion>\fR |
| 1863 |
Adjusts the scan. |
| 1864 |
.IP \fB<ButtonRelease-2>\fR |
| 1865 |
Stops scanning. |
| 1866 |
.IP \fB<B1-Leave>\fR |
| 1867 |
Starts auto-scrolling. |
| 1868 |
.IP \fB<B1-Enter>\fR |
| 1869 |
Starts auto-scrolling |
| 1870 |
.IP \fB<KeyPress-Up>\fR |
| 1871 |
Moves the focus to the previous entry. |
| 1872 |
.IP \fB<KeyPress-Down>\fR |
| 1873 |
Moves the focus to the next entry. |
| 1874 |
.IP \fB<Shift-KeyPress-Up>\fR |
| 1875 |
Moves the focus to the previous sibling. |
| 1876 |
.IP \fB<Shift-KeyPress-Down>\fR |
| 1877 |
Moves the focus to the next sibling. |
| 1878 |
.IP \fB<KeyPress-Prior>\fR |
| 1879 |
Moves the focus to first entry. Closed or hidden entries |
| 1880 |
are ignored. |
| 1881 |
.IP \fB<KeyPress-Next>\fR |
| 1882 |
Move the focus to the last entry. Closed or hidden entries |
| 1883 |
are ignored. |
| 1884 |
.IP \fB<KeyPress-Left>\fR |
| 1885 |
Closes the entry. It is not an error if the entry has no children. |
| 1886 |
.IP \fB<KeyPress-Right>\fR |
| 1887 |
Opens the entry, displaying its children. It is not an |
| 1888 |
error if the entry has no children. |
| 1889 |
.IP \fB<KeyPress-space>\fR |
| 1890 |
In "single" select mode this selects the entry. In "multiple" mode, |
| 1891 |
it toggles the entry (if it was previous selected, it is not |
| 1892 |
deselected). |
| 1893 |
.IP \fB<KeyRelease-space>\fR |
| 1894 |
Turns off select mode. |
| 1895 |
.IP \fB<KeyPress-Return>\fR |
| 1896 |
Sets the focus to the current entry. |
| 1897 |
.IP \fB<KeyRelease-Return>\fR |
| 1898 |
Turns off select mode. |
| 1899 |
.IP \fB<KeyPress>\fR |
| 1900 |
Moves to the next entry whose label starts with the letter typed. |
| 1901 |
.IP \fB<KeyPress-Home>\fR |
| 1902 |
Moves the focus to first entry. Closed or hidden entries |
| 1903 |
are ignored. |
| 1904 |
.IP \fB<KeyPress-End>\fR |
| 1905 |
Move the focus to the last entry. Closed or hidden entries |
| 1906 |
are ignored. |
| 1907 |
.IP \fB<KeyPress-F1>\fR |
| 1908 |
Opens all entries. |
| 1909 |
.IP \fB<KeyPress-F2>\fR |
| 1910 |
Closes all entries (except root). |
| 1911 |
.SS BUTTON BINDINGS |
| 1912 |
Buttons have bindings. There are associated with the "all" bindtag |
| 1913 |
(see the entry's -bindtag option). You can use the \fBbind\fR |
| 1914 |
operation to change them. |
| 1915 |
.IP \fB<Enter>\fR |
| 1916 |
Highlights the button of the current entry. |
| 1917 |
.IP \fB<Leave>\fR |
| 1918 |
Returns the button back to its normal state. |
| 1919 |
.IP \fB<ButtonRelease-1>\fR |
| 1920 |
Adjust the view so that the current entry is visible. |
| 1921 |
.SS ENTRY BINDINGS |
| 1922 |
Entries have default bindings. There are associated with the "all" |
| 1923 |
bindtag (see the entry's -bindtag option). You can use the \fBbind\fR |
| 1924 |
operation to modify them. |
| 1925 |
.IP \fB<Enter>\fR |
| 1926 |
Highlights the current entry. |
| 1927 |
.IP \fB<Leave>\fR |
| 1928 |
Returns the entry back to its normal state. |
| 1929 |
.IP \fB<ButtonPress-1>\fR |
| 1930 |
Sets the selection anchor the current entry. |
| 1931 |
.IP \fB<Double-ButtonPress-1>\fR |
| 1932 |
Toggles the selection of the current entry. |
| 1933 |
.IP \fB<B1-Motion>\fR |
| 1934 |
For "multiple" mode only. Saves the current location of the |
| 1935 |
pointer for auto-scrolling. Resets the selection mark. |
| 1936 |
.IP \fB<ButtonRelease-1>\fR |
| 1937 |
For "multiple" mode only. Sets the selection anchor to the |
| 1938 |
current entry. |
| 1939 |
.IP \fB<Shift-ButtonPress-1>\fR |
| 1940 |
For "multiple" mode only. Extends the selection. |
| 1941 |
.IP \fB<Shift-Double-ButtonPress-1>\fR |
| 1942 |
Place holder. Does nothing. |
| 1943 |
.IP \fB<Shift-B1-Motion>\fR |
| 1944 |
Place holder. Does nothing. |
| 1945 |
.IP \fB<Shift-ButtonRelease-1>\fR |
| 1946 |
Stop auto-scrolling. |
| 1947 |
.IP \fB<Control-ButtonPress-1>\fR |
| 1948 |
For "multiple" mode only. Toggles and extends the selection. |
| 1949 |
.IP \fB<Control-Double-ButtonPress-1>\fR |
| 1950 |
Place holder. Does nothing. |
| 1951 |
.IP \fB<Control-B1-Motion>\fR |
| 1952 |
Place holder. Does nothing. |
| 1953 |
.IP \fB<Control-ButtonRelease-1>\fR |
| 1954 |
Stops auto-scrolling. |
| 1955 |
.IP \fB<Control-Shift-ButtonPress-1>\fR |
| 1956 |
??? |
| 1957 |
.IP \fB<Control-Shift-Double-ButtonPress-1>\fR |
| 1958 |
Place holder. Does nothing. |
| 1959 |
.IP \fB<Control-Shift-B1-Motion>\fR |
| 1960 |
Place holder. Does nothing. |
| 1961 |
.SS COLUMN BINDINGS |
| 1962 |
Columns have bindings too. They are associated with the column's |
| 1963 |
"all" bindtag (see the column -bindtag option). You can use the |
| 1964 |
\fBcolumn bind\fR operation to change them. |
| 1965 |
.IP \fB<Enter>\fR |
| 1966 |
Highlights the current column title. |
| 1967 |
.IP \fB<Leave>\fR |
| 1968 |
Returns the column back to its normal state. |
| 1969 |
.IP \fB<ButtonRelease-1>\fR |
| 1970 |
Invokes the command (see the column's -command option) if one |
| 1971 |
if specified. |
| 1972 |
.SS COLUMN RULE BINDINGS |
| 1973 |
.IP \fB<Enter>\fR |
| 1974 |
Highlights the current and activates the ruler. |
| 1975 |
.IP \fB<Leave>\fR |
| 1976 |
Returns the column back to its normal state. Deactivates the |
| 1977 |
ruler. |
| 1978 |
.IP \fB<ButtonPress-1>\fR |
| 1979 |
Sets the resize anchor for the column. |
| 1980 |
.IP \fB<B1-Motion>\fR |
| 1981 |
Sets the resize mark for the column. |
| 1982 |
.IP \fB<ButtonRelease-1>\fR |
| 1983 |
Adjust the size of the column, based upon the resize anchor and mark |
| 1984 |
positions. |
| 1985 |
.SH EXAMPLE |
| 1986 |
The \fBtreeview\fR command creates a new widget. |
| 1987 |
.CS |
| 1988 |
treeview .h \-bg white |
| 1989 |
.CE |
| 1990 |
A new Tcl command \fB.h\fR is also created. This command can be used |
| 1991 |
to query and modify the \fBtreeview\fR widget. For example, to change the |
| 1992 |
background |
| 1993 |
color of the table to "green", you use the new command and the widget's |
| 1994 |
\fBconfigure\fR operation. |
| 1995 |
.CS |
| 1996 |
# Change the background color. |
| 1997 |
\&.h configure \-background "green" |
| 1998 |
.CE |
| 1999 |
By default, the \fBtreeview\fR widget will automatically create a new tree object |
| 2000 |
to contain the data. The name of the new tree is the pathname of the |
| 2001 |
widget. Above, the new tree object name is ".h". But you can use the |
| 2002 |
\fB\-tree\fR option to specify the name of another tree. |
| 2003 |
.CS |
| 2004 |
# View the tree "myTree". |
| 2005 |
\&.h configure \-tree "myTree" |
| 2006 |
.CE |
| 2007 |
When a new tree is created, it contains only a root node. The node |
| 2008 |
is automatically opened. The id of the root node is always |
| 2009 |
\fB0\fR (you can use also use the special id \fBroot\fR). The |
| 2010 |
\fBinsert\fR operation lets you insert one or more new entries into |
| 2011 |
the tree. The last argument is the node's \fIpathname\fR. |
| 2012 |
.CS |
| 2013 |
# Create a new entry named "myEntry" |
| 2014 |
set id [\&.h insert end "myEntry"] |
| 2015 |
.CE |
| 2016 |
This appends a new node named "myEntry". It will positioned as the |
| 2017 |
last child of the root of the tree (using the position "end"). You |
| 2018 |
can supply another position to order the node within its siblings. |
| 2019 |
.CS |
| 2020 |
# Prepend "fred". |
| 2021 |
set id [\&.h insert 0 "fred"] |
| 2022 |
.CE |
| 2023 |
Entry names do not need to be unique. By default, the node's label |
| 2024 |
is its name. To supply a different text label, add the \fB\-label\fR |
| 2025 |
option. |
| 2026 |
.CS |
| 2027 |
# Create a new node named "fred" |
| 2028 |
set id [\&.h insert end "fred" -label "Fred Flintstone"] |
| 2029 |
.CE |
| 2030 |
The \fBinsert\fR operation returns the id of the new node. You can |
| 2031 |
also use the \fBindex\fR operation to get this information. |
| 2032 |
.CS |
| 2033 |
# Get the id of "fred" |
| 2034 |
\&.h index "fred" |
| 2035 |
.CE |
| 2036 |
To insert a node somewhere other than root, use the \fB\-at\fR switch. |
| 2037 |
It takes the id of the node where the new child will be added. |
| 2038 |
.CS |
| 2039 |
# Create a new node "barney" in "fred". |
| 2040 |
\&.h insert -at $id end "barney" |
| 2041 |
.CE |
| 2042 |
A pathname describes the path to an entry in the hierarchy. It's a |
| 2043 |
list of entry names that compose the path in the tree. Therefore, you |
| 2044 |
can also add "barney" to "fred" as follows. |
| 2045 |
.CS |
| 2046 |
# Create a new sub-entry of "fred" |
| 2047 |
\&.h insert end "fred barney" |
| 2048 |
.CE |
| 2049 |
Every name in the list is ancestor of the next. All ancestors must |
| 2050 |
already exist. That means that an entry "fred" is an ancestor of |
| 2051 |
"barney" and must already exist. But you can use the |
| 2052 |
\fB\-autocreate\fR configuration option to force the creation of |
| 2053 |
ancestor nodes. |
| 2054 |
.CS |
| 2055 |
# Force the creation of ancestors. |
| 2056 |
\&.h configure -autocreate yes |
| 2057 |
\&.h insert end "fred barney wilma betty" |
| 2058 |
.CE |
| 2059 |
Sometimes the pathname is already separated by a character sequence |
| 2060 |
rather than formed as a list. A file name is a good example of this. |
| 2061 |
You can use the \fB\-separator\fR option to specify a separator string |
| 2062 |
to split the path into its components. Each pathname inserted is |
| 2063 |
automatically split using the separator string as a separator. |
| 2064 |
Multiple separators are treated as one. |
| 2065 |
.CS |
| 2066 |
\&.h configure -separator / |
| 2067 |
\&.h insert end "/usr/local/tcl/bin" |
| 2068 |
.CE |
| 2069 |
If the path is prefixed by extraneous characters, you can |
| 2070 |
automatically trim it off using the \fB\-trim\fR option. It removed |
| 2071 |
the string from the path before it is parsed. |
| 2072 |
.CS |
| 2073 |
\&.h configure -trim C:/windows -separator / |
| 2074 |
\&.h insert end "C:/window/system" |
| 2075 |
.CE |
| 2076 |
You can insert more than one entry at a time with the \fBinsert\fR |
| 2077 |
operation. This can be much faster than looping over a list of names. |
| 2078 |
.CS |
| 2079 |
# The slow way |
| 2080 |
foreach f [glob $dir/*] { |
| 2081 |
\&.h insert end $f |
| 2082 |
} |
| 2083 |
# The fast way |
| 2084 |
eval .h insert end [glob $dir/*] |
| 2085 |
.CE |
| 2086 |
In this case, the \fBinsert\fR operation will return a list of ids |
| 2087 |
of the new entries. |
| 2088 |
.PP |
| 2089 |
You can delete entries with the \fBdelete\fR operation. It takes one or |
| 2090 |
more tags of ids as its argument. It deletes the entry and all its |
| 2091 |
children. |
| 2092 |
.CS |
| 2093 |
\&.h delete $id |
| 2094 |
.CE |
| 2095 |
Entries have several configuration options. They control the appearance |
| 2096 |
of the entry's icon and label. We have already seen the \fB\-label\fR |
| 2097 |
option that sets the entry's text label. The \fBentry configure\fR |
| 2098 |
operation lets you set or modify an entry's configuration options. |
| 2099 |
.CS |
| 2100 |
\&.h entry configure $id -color red -font fixed |
| 2101 |
.CE |
| 2102 |
You can hide an entry and its children using the \fB\-hide\fR option. |
| 2103 |
.CS |
| 2104 |
\&.h entry configure $id -hide yes |
| 2105 |
.CE |
| 2106 |
More that one entry can be configured at once. All entries specified |
| 2107 |
are configured with the same options. |
| 2108 |
.CS |
| 2109 |
\&.h entry configure $i1 $i2 $i3 $i4 -color brown |
| 2110 |
.CE |
| 2111 |
An icon is displayed for each entry. It's a Tk image drawn to the |
| 2112 |
left of the label. You can set the icon with the entry's |
| 2113 |
\fB\-icons\fR option. It takes a list of two image names: one to |
| 2114 |
represent the open entry, another when it is closed. |
| 2115 |
.CS |
| 2116 |
set im1 [image create photo -file openfolder.gif] |
| 2117 |
set im2 [image create photo -file closefolder.gif] |
| 2118 |
\&.h entry configure $id -icons "$im1 $im2" |
| 2119 |
.CE |
| 2120 |
If \fB\-icons\fR is set to the empty string, no icons are display. |
| 2121 |
.PP |
| 2122 |
If an entry has children, a button is displayed to the left of the |
| 2123 |
icon. Clicking the mouse on this button opens or closes the |
| 2124 |
sub-hierarchy. The button is normally a \fB+\fR or \fB\-\fR |
| 2125 |
symbol, but can be configured in a variety of ways using the \fBbutton |
| 2126 |
configure\fR operation. For example, the \fB+\fR and \fB\-\fR |
| 2127 |
symbols can be replaced with Tk images. |
| 2128 |
.CS |
| 2129 |
set im1 [image create photo -file closefolder.gif] |
| 2130 |
set im2 [image create photo -file downarrow.gif] |
| 2131 |
\&.h button configure $id -images "$im1 $im2" \\ |
| 2132 |
-openrelief raised -closerelief raised |
| 2133 |
.CE |
| 2134 |
Entries can contain an arbitrary number of \fIdata fields\fR. Data |
| 2135 |
fields are name-value pairs. Both the value and name are strings. |
| 2136 |
The entry's \fB\-data\fR option lets you set data fields. |
| 2137 |
.CS |
| 2138 |
\&.h entry configure $id -data {mode 0666 group users} |
| 2139 |
.CE |
| 2140 |
The \fB\-data\fR takes a list of name-value pairs. |
| 2141 |
.PP |
| 2142 |
You can display these data fields as \fIcolumns\fR in the |
| 2143 |
\fBtreeview\fR widget. You can create and configure columns with |
| 2144 |
the \fBcolumn\fR operation. For example, to add a new column to the |
| 2145 |
widget, use the \fBcolumn insert\fR operation. The last argument is |
| 2146 |
the name of the data field that you want to display. |
| 2147 |
.CS |
| 2148 |
\&.h column insert end "mode" |
| 2149 |
.CE |
| 2150 |
The column title is displayed at the top of the column. By default, |
| 2151 |
it's is the field name. You can override this using the column's |
| 2152 |
\fB\-text\fR option. |
| 2153 |
.CS |
| 2154 |
\&.h column insert end "mode" -text "File Permissions" |
| 2155 |
.CE |
| 2156 |
Columns have several configuration options. The \fBcolumn |
| 2157 |
configure\fR operation lets you query or modify column options. |
| 2158 |
.CS |
| 2159 |
\&.h column configure "mode" -justify left |
| 2160 |
.CE |
| 2161 |
The \fB\-justify\fR option says how the data is justified within in |
| 2162 |
the column. The \fB\-hide\fR option indicates whether the column is |
| 2163 |
displayed. |
| 2164 |
.CS |
| 2165 |
\&.h column configure "mode" -hide yes |
| 2166 |
.CE |
| 2167 |
Entries can be selected by clicking on the mouse. Selected entries |
| 2168 |
are drawn using the colors specified by the \fB\-selectforeground\fR |
| 2169 |
and \fB\-selectbackground\fR configuration options. |
| 2170 |
The selection itself is managed by the \fBselection\fR operation. |
| 2171 |
.CS |
| 2172 |
# Clear all selections |
| 2173 |
\&.h selection clear 0 end |
| 2174 |
# Select the root node |
| 2175 |
\&.h selection set 0 |
| 2176 |
.CE |
| 2177 |
The \fBcurselection\fR operation returns a list of ids of |
| 2178 |
all the selected entries. |
| 2179 |
.CS |
| 2180 |
set ids [\&.h curselection] |
| 2181 |
.CE |
| 2182 |
You can use the \fBget\fR operation to convert the ids to |
| 2183 |
their pathnames. |
| 2184 |
.CS |
| 2185 |
set names [eval .h get -full $ids] |
| 2186 |
.CE |
| 2187 |
If a treeview is exporting its selection (using the |
| 2188 |
\fB\-exportselection\fR option), then it will observe the standard X11 |
| 2189 |
protocols for handling the selection. Treeview selections are |
| 2190 |
available as type \fBSTRING\fR; the value of the selection will be the |
| 2191 |
pathnames of the selected entries, separated by newlines. |
| 2192 |
.PP |
| 2193 |
The \fBtreeview\fR supports two modes of selection: \fBsingle\fR |
| 2194 |
and \fBmultiple\fR. In single select mode, only one entry can be |
| 2195 |
selected at a time, while multiple select mode allows several entries |
| 2196 |
to be selected. The mode is set by the widget's \fB\-selectmode\fR |
| 2197 |
option. |
| 2198 |
.CS |
| 2199 |
\&.h configure -selectmode "multiple" |
| 2200 |
.CE |
| 2201 |
You can be notified when the list of selected entries changes. The widget's |
| 2202 |
\fB\-selectcommand\fR specifies a Tcl procedure that is called whenever |
| 2203 |
the selection changes. |
| 2204 |
.CS |
| 2205 |
proc SelectNotify { widget } { |
| 2206 |
set ids [\&$widget curselection] |
| 2207 |
} |
| 2208 |
\&.h configure -selectcommand "SelectNotify .h" |
| 2209 |
.CE |
| 2210 |
The widget supports the standard Tk scrolling and scanning operations. |
| 2211 |
The \fBtreeview\fR can be both horizontally and vertically. You can |
| 2212 |
attach scrollbars to the \fBtreeview\fR the same way as the listbox |
| 2213 |
or canvas widgets. |
| 2214 |
.CS |
| 2215 |
scrollbar .xbar -orient horizontal -command ".h xview" |
| 2216 |
scrollbar .ybar -orient vertical -command ".h yview" |
| 2217 |
\&.h configure -xscrollcommand ".xbar set" \\ |
| 2218 |
-yscrollcommand ".ybar set" |
| 2219 |
.CE |
| 2220 |
There are three different modes of scrolling: \fBlistbox\fR, |
| 2221 |
\fBcanvas\fR, and \fBhierbox\fR. In \fBlistbox\fR mode, the last |
| 2222 |
entry can always be scrolled to the top of the widget. In \fBhierbox\fR |
| 2223 |
mode, the last entry is always drawn at the bottom of the widget. |
| 2224 |
The scroll mode is set by the widget's \fB\-selectmode\fR |
| 2225 |
option. |
| 2226 |
.CS |
| 2227 |
\&.h configure -scrollmode "listbox" |
| 2228 |
.CE |
| 2229 |
Entries can be programmatically opened or closed using the \fBopen\fR |
| 2230 |
and \fBclose\fR operations respectively. |
| 2231 |
.CS |
| 2232 |
\&.h open $id |
| 2233 |
\&.h close $id |
| 2234 |
.CE |
| 2235 |
When an entry is opened, a Tcl procedure can be automatically invoked. |
| 2236 |
The \fB\-opencommand\fR option specifies this procedure. This |
| 2237 |
procedure can lazily insert entries as needed. |
| 2238 |
.CS |
| 2239 |
proc AddEntries { dir } { |
| 2240 |
eval .h insert end [glob -nocomplain $dir/*] |
| 2241 |
} |
| 2242 |
\&.h configure -opencommand "AddEntries %P" |
| 2243 |
.CE |
| 2244 |
Now when an entry is opened, the procedure \fBAddEntries\fR is |
| 2245 |
called and adds children to the entry. Before the command is invoked, |
| 2246 |
special "%" substitutions (like \fBbind\fR) are performed. Above, |
| 2247 |
\fB%P\fR is translated to the pathname of the entry. |
| 2248 |
.PP |
| 2249 |
The same feature exists when an entry is closed. The |
| 2250 |
\fB\-closecommand\fR option specifies the procedure. |
| 2251 |
.CS |
| 2252 |
proc DeleteEntries { id } { |
| 2253 |
.h entry delete $id 0 end |
| 2254 |
} |
| 2255 |
\&.h configure -closecommand "DeleteEntries %#" |
| 2256 |
.CE |
| 2257 |
When an entry is closed, the procedure \fBDeleteEntries\fR is called |
| 2258 |
and deletes the entry's children using the \fBentry delete\fR operation |
| 2259 |
(\fB%#\fR is the id of entry). |
| 2260 |
.SH KEYWORDS |
| 2261 |
treeview, widget |