From 8323f2a7eaac30f421e11a0372436c496c0443fc Mon Sep 17 00:00:00 2001 From: treectrl Date: Fri, 13 May 2005 20:29:13 +0000 Subject: Use column -tag instead of zero, to handle -columnprefix option if used. --- demos/firefox.tcl | 46 ++++++++++++++++++++++++---------------------- demos/imovie.tcl | 14 +++++++------- demos/layout.tcl | 25 +++++++++++++------------ demos/outlook-folders.tcl | 13 +++++++------ demos/www-options.tcl | 16 +++++++++------- 5 files changed, 60 insertions(+), 54 deletions(-) diff --git a/demos/firefox.tcl b/demos/firefox.tcl index f310e98..8906b36 100644 --- a/demos/firefox.tcl +++ b/demos/firefox.tcl @@ -39,9 +39,11 @@ proc DemoFirefoxPrivacy {} { } $T column create -expand yes -arrowimage {arrow-down !up arrow-up {}} \ - -arrow up -arrowpadx {10 2} -textlines 0 \ + -arrow up -arrowpadx {10 2} -textlines 0 -tag C0 \ -text "This is a multi-line column title\nwith an image for the arrow" + $T configure -treecolumn C0 + # This binding toggles the sort arrow $T notify bind $T { if {[%T column cget %C -arrow] eq "up"} { @@ -84,10 +86,10 @@ proc DemoFirefoxPrivacy {} { "Cookies" "Cache"} { set I [$T item create -button yes] - $T item style set $I 0 styCategory - $T item element configure $I 0 eText1 -text $category + $T item style set $I C0 styCategory + $T item element configure $I C0 eText1 -text $category set b [button $T.b$I -text "Clear" -command "" -width 11] - $T item element configure $I 0 eWindow -window $b + $T item element configure $I C0 eWindow -window $b $T item lastchild root $I } @@ -96,7 +98,7 @@ proc DemoFirefoxPrivacy {} { # History set I [$T item create] - $T item style set $I 0 styFrame + $T item style set $I C0 styFrame set f [frame $T.f$I -borderwidth 0 -background $bg] label $f.l1 -background $bg -text "Remember visited pages for the last" entry $f.e1 -width 6 -background $bg @@ -105,12 +107,12 @@ proc DemoFirefoxPrivacy {} { pack $f.l1 -side left pack $f.e1 -side left -padx 8 pack $f.l2 -side left - $T item element configure $I 0 eWindow -window $f - $T item lastchild [$T index "root child 0"] $I + $T item element configure $I C0 eWindow -window $f + $T item lastchild "root child 0" $I # Saved Form Information set I [$T item create] - $T item style set $I 0 styFrame + $T item style set $I C0 styFrame set f [frame $T.f$I -borderwidth 0 -background $bg] text $f.t1 -background $textBg -borderwidth 0 -width 10 -height 1 -wrap word -cursor "" $f.t1 insert end "Information entered in web page forms and the Search Bar is saved to make filling out forms and searching faster." @@ -119,12 +121,12 @@ proc DemoFirefoxPrivacy {} { $f.cb1 select pack $f.t1 -side top -anchor w -fill x -padx {0 10} -pady {0 4} pack $f.cb1 -side top -anchor w - $T item element configure $I 0 eWindow -window $f - $T item lastchild [$T index "root child 1"] $I + $T item element configure $I C0 eWindow -window $f + $T item lastchild "root child 1" $I # Saved Passwords set I [$T item create] - $T item style set $I 0 styFrame + $T item style set $I C0 styFrame set f [frame $T.f$I -borderwidth 0 -background $bg] set fLeft [frame $f.fLeft -borderwidth 0 -background $bg] @@ -143,12 +145,12 @@ proc DemoFirefoxPrivacy {} { pack $fRight.b2 -side top -expand yes -fill x -pady {8 0} pack $fLeft -side left -expand yes -fill x pack $fRight -side right -padx 14 -anchor n - $T item element configure $I 0 eWindow -window $f - $T item lastchild [$T index "root child 2"] $I + $T item element configure $I C0 eWindow -window $f + $T item lastchild "root child 2" $I # Download Manager History set I [$T item create] - $T item style set $I 0 styFrame + $T item style set $I C0 styFrame set f [frame $T.f$I -borderwidth 0 -background $bg] text $f.t1 -background $textBg -borderwidth 0 -width 10 -height 1 -wrap word -cursor "" $f.t1 insert end "The Download Manager keeps track of recently downloaded files." @@ -169,12 +171,12 @@ proc DemoFirefoxPrivacy {} { pack $f1.mb1 -side left -padx {8 10} pack $f.t1 -side top -expand yes -fill x -padx {0 10} pack $f1 -side top -anchor w - $T item element configure $I 0 eWindow -window $f - $T item lastchild [$T index "root child 3"] $I + $T item element configure $I C0 eWindow -window $f + $T item lastchild "root child 3" $I # Cookies set I [$T item create] - $T item style set $I 0 styFrame + $T item style set $I C0 styFrame set f [frame $T.f$I -borderwidth 0 -background $bg] text $f.t1 -background $textBg -borderwidth 0 -width 10 -height 1 -wrap word -cursor "" $f.t1 insert end "Cookies are pieces of information stored by web pages on your computer. They are used to remember login information and other data." @@ -211,12 +213,12 @@ proc DemoFirefoxPrivacy {} { pack $f.t1 -side top -expand yes -fill x -padx {0 10} -pady {0 8} pack $fLeft -side left -expand yes -fill x pack $fRight -side right -padx 14 -anchor n - $T item element configure $I 0 eWindow -window $f - $T item lastchild [$T index "root child 4"] $I + $T item element configure $I C0 eWindow -window $f + $T item lastchild "root child 4" $I # Cache set I [$T item create] - $T item style set $I 0 styFrame + $T item style set $I C0 styFrame set f [frame $T.f$I -borderwidth 0 -background $bg] text $f.t1 -background $textBg -borderwidth 0 -width 10 -height 1 -wrap word -cursor "" $f.t1 insert end "Pages you view are stored in the cache for quicker viewing later on." @@ -231,8 +233,8 @@ proc DemoFirefoxPrivacy {} { pack $f1.l2 -side left pack $f.t1 -side top -expand yes -fill x -padx {0 10} pack $f1 -side top -anchor w - $T item element configure $I 0 eWindow -window $f - $T item lastchild [$T index "root child 5"] $I + $T item element configure $I C0 eWindow -window $f + $T item lastchild "root child 5" $I # This binding configures the -height option of a Text widget to the # number of lines it is displaying diff --git a/demos/imovie.tcl b/demos/imovie.tcl index bf73da3..a9d93cc 100644 --- a/demos/imovie.tcl +++ b/demos/imovie.tcl @@ -17,7 +17,7 @@ proc DemoIMovie {} { # Create columns # - $T column create + $T column create -tag C0 InitPics imovie-* @@ -79,10 +79,10 @@ proc DemoIMovie {} { 07:20 "Clip 7" imovie-07 } { set I [$T item create] -# $T item style set $I 0 $S - $T item element configure $I 0 elemTime -text $time - $T item element configure $I 0 elemImg -image $image - $T item element configure $I 0 elemName -text $name +# $T item style set $I C0 $S + $T item element configure $I C0 elemTime -text $time + $T item element configure $I C0 elemImg -image $image + $T item element configure $I C0 elemName -text $name $T item lastchild root $I } } @@ -123,11 +123,11 @@ proc iMovieButton1 {T x y} { set E [lindex $id end] if {$E eq "elemName"} { set exists [winfo exists $T.entry] - ::TreeCtrl::EntryOpen $T $I 0 $E + ::TreeCtrl::EntryOpen $T $I C0 $E if {!$exists} { $T.entry configure -borderwidth 0 -justify center \ -background #ffdc5a - scan [$T item bbox $I 0 $E] "%d %d %d %d" x1 y1 x2 y2 + scan [$T item bbox $I C0 $E] "%d %d %d %d" x1 y1 x2 y2 place $T.entry -y [expr {$y1 - 1}] } $T.entry selection clear diff --git a/demos/layout.tcl b/demos/layout.tcl index 7a3ca89..4f67624 100644 --- a/demos/layout.tcl +++ b/demos/layout.tcl @@ -16,7 +16,8 @@ proc DemoLayout {} { # Create columns # - $T column create -text Layout + $T column create -text Layout -tag C0 + $T configure -treecolumn C0 # # Create elements @@ -52,12 +53,12 @@ proc DemoLayout {} { # set I [$T item create -button yes] - $T item style set $I 0 $S + $T item style set $I C0 $S $T item lastchild root $I set parent $I set I [$T item create] - $T item style set $I 0 $S + $T item style set $I C0 $S $T item lastchild $parent $I ### @@ -69,11 +70,11 @@ proc DemoLayout {} { $T style layout $S e4 -detach yes -iexpand es set I [$T item create -button yes] - $T item style set $I 0 $S + $T item style set $I C0 $S $T item lastchild root $I set I2 [$T item create] - $T item style set $I2 0 $S + $T item style set $I2 C0 $S $T item lastchild $I $I2 ### @@ -85,11 +86,11 @@ proc DemoLayout {} { $T style layout $S e5 -ipady {0 20} set I [$T item create -button yes] - $T item style set $I 0 $S + $T item style set $I C0 $S $T item lastchild root $I set I2 [$T item create] - $T item style set $I2 0 $S + $T item style set $I2 C0 $S $T item lastchild $I $I2 ### @@ -106,14 +107,14 @@ proc DemoLayout {} { $T style layout $S et -squeeze x set I [$T item create -button yes] - $T item style set $I 0 $S - $T item text $I 0 $text + $T item style set $I C0 $S + $T item text $I C0 $text $T item lastchild root $I set parent $I set I [$T item create] - $T item style set $I 0 $S - $T item text $I 0 $text + $T item style set $I C0 $S + $T item text $I C0 $text $T item lastchild $parent $I ### @@ -132,7 +133,7 @@ proc DemoLayout {} { incr styleNum set I [$T item create] - $T item style set $I 0 $S + $T item style set $I C0 $S $T item lastchild root $I } } diff --git a/demos/outlook-folders.tcl b/demos/outlook-folders.tcl index 7bd8ed9..abc57ef 100644 --- a/demos/outlook-folders.tcl +++ b/demos/outlook-folders.tcl @@ -23,7 +23,8 @@ proc DemoOutlookFolders {} { # Create columns # - $T column create -text Folders + $T column create -text Folders -tag C0 + $T configure -treecolumn C0 # # Create elements @@ -77,7 +78,7 @@ proc DemoOutlookFolders {} { # Create items and assign styles # - $T item style set root 0 s1 + $T item style set root C0 s1 $T item complex root [list [list e1 -image outlook-main] [list e2 -text "Outlook Express"]] set parentList [list root {} {} {} {} {} {}] @@ -101,18 +102,18 @@ proc DemoOutlookFolders {} { set item [$T item create -button $button] if {[string equal $img folder]} { if {$unread} { - $T item style set $item 0 s4 + $T item style set $item C0 s4 $T item complex $item [list [list e3 -text $text] [list e4 -text "($unread)"]] } else { - $T item style set $item 0 s3 + $T item style set $item C0 s3 $T item complex $item [list [list e2 -text $text]] } } else { if {$unread} { - $T item style set $item 0 s2 + $T item style set $item C0 s2 $T item complex $item [list [list e1 -image outlook-$img] [list e3 -text $text] [list e4 -text "($unread)"]] } else { - $T item style set $item 0 s1 + $T item style set $item C0 s1 $T item complex $item [list [list e1 -image outlook-$img] [list e2 -text $text]] } } diff --git a/demos/www-options.tcl b/demos/www-options.tcl index a53e3f5..6241eca 100644 --- a/demos/www-options.tcl +++ b/demos/www-options.tcl @@ -20,16 +20,18 @@ proc DemoInternetOptions {} { # Create columns # - $T column create -text "Internet Options" + $T column create -text "Internet Options" -tag C0 - $T state define check - $T state define radio - $T state define on + $T configure -treecolumn C0 # # Create elements # + $T state define check + $T state define radio + $T state define on + $T element create e1 image -image { internet-check-on {check on} internet-check-off {check} @@ -69,8 +71,8 @@ proc DemoInternetOptions {} { 1 off "Check for server certificate revocation (requires restart)" "o6" "" } { set item [$T item create] - $T item style set $item 0 s1 - $T item element configure $item 0 e2 -text $text + $T item style set $item C0 s1 + $T item element configure $item C0 e2 -text $text set ::Option(option,$item) $option set ::Option(group,$item) $group if {($setting eq "on") || ($setting eq "off")} { @@ -88,7 +90,7 @@ proc DemoInternetOptions {} { $T item state set $item radio } } else { - $T item element configure $item 0 e1 -image internet-$setting + $T item element configure $item C0 e1 -image internet-$setting } $T item lastchild [lindex $parentList $depth] $item incr depth -- cgit v0.12