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