From ed2e8278356d18cb4b57015b96d1495e0a7f471c Mon Sep 17 00:00:00 2001 From: treectrl Date: Tue, 23 Oct 2007 23:04:33 +0000 Subject: Added some comments about the importance of order in per-state options. [BUG 1816723] --- doc/treectrl.html | 17 +++++++++++++++-- doc/treectrl.man | 15 ++++++++++++++- doc/treectrl.n | 17 ++++++++++++++++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/doc/treectrl.html b/doc/treectrl.html index 427b705..bee1e6f 100644 --- a/doc/treectrl.html +++ b/doc/treectrl.html @@ -1,10 +1,10 @@ - treectrl - Tk Commands - @@ -3400,6 +3400,19 @@ In the example above, the rect element is filled with blue when has the focus and the item is selected. If the treectrl does not have the focus, the example specifies that gray should be used for selected items. Also note that if the item is not selected, no color is specified for the -fill option. +

+Each value-stateList pair is checked in order from left to right. The value +associated with the first stateList that matches the current item state is +used. So stateLists should be listed from most-specific to least-specific. +

 
+$T element configure MyRectElement -fill {gray {selected} blue {selected focus}}
+

+Written this way, gray will always be used for selected items since +it appears first, and blue will never be used for selected items regardless +of the focus. +

+A value followed by an empty stateList should always be last since it will be +chosen regardless of the item's state.

ELEMENTS

diff --git a/doc/treectrl.man b/doc/treectrl.man index 1723088..a1ce326 100644 --- a/doc/treectrl.man +++ b/doc/treectrl.man @@ -3,7 +3,7 @@ See the file "license.terms" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. - $Id: treectrl.man,v 1.50 2007/02/06 22:27:35 treectrl Exp $} + $Id: treectrl.man,v 1.51 2007/10/23 23:04:33 treectrl Exp $} ][manpage_begin treectrl n 2.2.3] [moddesc {Tk Commands}] [titledesc {Create and manipulate hierarchical multicolumn widgets}] @@ -2652,6 +2652,19 @@ In the example above, the [const rect] element is filled with blue when the tree has the focus and the item is selected. If the treectrl does not have the focus, the example specifies that gray should be used for selected items. Also note that if the item is not selected, no color is specified for the -fill option. +[para] +Each value-stateList pair is checked in order from left to right. The value +associated with the first stateList that matches the current item state is +used. So stateLists should be listed from most-specific to least-specific. +[example_begin] +$T element configure MyRectElement -fill {gray {selected} blue {selected focus}} +[example_end] +Written this way, gray will always be used for selected items since +it appears first, and blue will never be used for selected items regardless +of the focus. +[para] +A value followed by an empty stateList should always be last since it will be +chosen regardless of the item's state. [section ELEMENTS] Elements are the smallest building blocks diff --git a/doc/treectrl.n b/doc/treectrl.n index 8359a07..932421f 100644 --- a/doc/treectrl.n +++ b/doc/treectrl.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" $Id: treectrl.n,v 1.67 2007/02/06 22:27:35 treectrl Exp $ +'\" $Id: treectrl.n,v 1.68 2007/10/23 23:04:33 treectrl Exp $ .so man.macros .TH "treectrl" n 2.2.3 treectrl "Tk Commands" .BS @@ -3185,6 +3185,21 @@ In the example above, the \fBrect\fR element is filled with blue when the treect has the focus and the item is selected. If the treectrl does not have the focus, the example specifies that gray should be used for selected items. Also note that if the item is not selected, no color is specified for the -fill option. +.PP +Each value-stateList pair is checked in order from left to right. The value +associated with the first stateList that matches the current item state is +used. So stateLists should be listed from most-specific to least-specific. +.nf + +$T element configure MyRectElement -fill {gray {selected} blue {selected focus}} + +.fi +Written this way, gray will always be used for selected items since +it appears first, and blue will never be used for selected items regardless +of the focus. +.PP +A value followed by an empty stateList should always be last since it will be +chosen regardless of the item's state. .SH ELEMENTS Elements are the smallest building blocks which are handled by a treectrl widget. -- cgit v0.12