From 1c654351cd80f215d14aabf33013ff90bd75960d Mon Sep 17 00:00:00 2001 From: treectrl Date: Thu, 30 Nov 2006 03:31:27 +0000 Subject: Use the item option "-button auto". --- demos/random.tcl | 10 +++------- 1 file 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] -- cgit v0.12