diff options
author | treectrl <treectrl> | 2006-07-11 00:11:29 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2006-07-11 00:11:29 (GMT) |
commit | 5b2a3fc32fbcec70ba19513c091ad00b9bf246bc (patch) | |
tree | a522ecdadde368ad05a83dde6bf7debb33bc5641 /demos | |
parent | 5731c1a90ae97c63c5e29128439ef8331f346ff7 (diff) | |
download | tktreectrl-5b2a3fc32fbcec70ba19513c091ad00b9bf246bc.zip tktreectrl-5b2a3fc32fbcec70ba19513c091ad00b9bf246bc.tar.gz tktreectrl-5b2a3fc32fbcec70ba19513c091ad00b9bf246bc.tar.bz2 |
Add column-span demo.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/demo.tcl | 4 | ||||
-rw-r--r-- | demos/span.tcl | 68 |
2 files changed, 71 insertions, 1 deletions
diff --git a/demos/demo.tcl b/demos/demo.tcl index 91c59b0..0eb918e 100644 --- a/demos/demo.tcl +++ b/demos/demo.tcl @@ -1,6 +1,6 @@ #!/bin/wish84.exe -# RCS: @(#) $Id: demo.tcl,v 1.40 2005/09/25 20:53:24 hobbs2 Exp $ +# RCS: @(#) $Id: demo.tcl,v 1.41 2006/07/11 00:11:29 treectrl Exp $ set VERSION 2.1 @@ -160,6 +160,7 @@ foreach file { outlook-folders outlook-newgroup random + span textvariable www-options } { @@ -936,6 +937,7 @@ proc InitDemoList {} { "Firefox Privacy" DemoFirefoxPrivacy firefox.tcl \ "Textvariable" DemoTextvariable textvariable.tcl \ "Big List" DemoBigList biglist.tcl \ + "Column Spanning" DemoSpan span.tcl \ ] { set item [$t item create] $t item lastchild root $item diff --git a/demos/span.tcl b/demos/span.tcl new file mode 100644 index 0000000..fb9cb07 --- /dev/null +++ b/demos/span.tcl @@ -0,0 +1,68 @@ +# RCS: @(#) $Id: span.tcl,v 1.1 2006/07/11 00:11:54 treectrl Exp $ + +# +# Demo: Column span +# +proc DemoSpan {} { + + set T .f2.f1.t + + # + # Configure the treectrl widget + # + + $T configure \ + -showbuttons no \ + -showlines no \ + -showroot no \ + -xscrollincrement 40 + + # + # Create columns + # + + for {set i 0} {$i < 100} {incr i} { + $T column create -text "$i" -tag C$i -width 40 + } + + # + # Create elements + # + + for {set i 1} {$i <= 20} {incr i} { + set color gray[expr {50 + $i * 2}] + $T element create e$i rect -width [expr {$i * 40}] -height 20 \ + -fill $color -outlinewidth 1 -outline gray70 + $T element create t$i text -text "Span $i" + } + + # + # Create styles using the elements + # + + for {set i 1} {$i <= 20} {incr i} { + set S [$T style create s$i] + $T style elements $S [list e$i t$i] + $T style layout $S e$i -detach yes + $T style layout $S t$i -expand ns -padx 2 + } + + # + # Create items and assign styles + # + + foreach I [$T item create -count 100 -parent root] { + for {set i 0} {$i < [$T column count]} {} { + set span [expr {int(rand() * 20) + 1}] + if {$span > [$T column count] - $i} { + set span [expr {[$T column count] - $i}] + } + $T item style set $I C$i s$span + $T item span $I C$i $span + incr i $span + } + } + + return +} + |