diff options
author | treectrl <treectrl> | 2006-11-30 03:31:27 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2006-11-30 03:31:27 (GMT) |
commit | 1c654351cd80f215d14aabf33013ff90bd75960d (patch) | |
tree | c94e5fbab36738763270895223eefee4a281592f | |
parent | d06d46b9d793a14d301e135e6fd76a0c77bbb7b5 (diff) | |
download | tktreectrl-1c654351cd80f215d14aabf33013ff90bd75960d.zip tktreectrl-1c654351cd80f215d14aabf33013ff90bd75960d.tar.gz tktreectrl-1c654351cd80f215d14aabf33013ff90bd75960d.tar.bz2 |
Use the item option "-button auto".
-rw-r--r-- | demos/random.tcl | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/demos/random.tcl b/demos/random.tcl index 0baef52..85bf7d7 100644 --- a/demos/random.tcl +++ b/demos/random.tcl @@ -1,4 +1,4 @@ -# RCS: @(#) $Id: random.tcl,v 1.24 2006/11/30 02:41:39 treectrl Exp $ +# RCS: @(#) $Id: random.tcl,v 1.25 2006/11/30 03:31:27 treectrl Exp $ set RandomN 500 set RandomDepth 5 @@ -86,7 +86,8 @@ proc DemoRandom {} { # set clicks [clock clicks] - set items [$T item create -count [expr {$::RandomN - 1}]] + $T item configure root -button auto + set items [$T item create -count [expr {$::RandomN - 1}] -button auto] set added root foreach itemi $items { set j [expr {int(rand() * [llength $added])}] @@ -94,9 +95,6 @@ proc DemoRandom {} { if {[$T depth $itemj] < $::RandomDepth - 1} { lappend added $itemi } - if {![$T item cget $itemj -button]} { - $T item configure $itemj -button yes - } if {rand() * 2 > 1} { $T item collapse $itemi } @@ -376,7 +374,6 @@ proc RandomDrop {T target source pos} { foreach item $parentList { set numChildren [$T item numchildren $item] if {$numChildren == 0} { - $T item configure $item -button no $T item style map $item colItem styFile {elemTxtName elemTxtName} } else { $T item element configure $item colItem elemTxtCount -text "($numChildren)" @@ -385,7 +382,6 @@ proc RandomDrop {T target source pos} { # Update the target that gained some children if {[$T item style set $parent colItem] ne "styFolder"} { - $T item configure $parent -button yes $T item style map $parent colItem styFolder {elemTxtName elemTxtName} } set numChildren [$T item numchildren $parent] |