From b11d2de32f045d2100bbe7558487b064dd1df91e Mon Sep 17 00:00:00 2001 From: treectrl Date: Mon, 26 Jul 2004 17:15:25 +0000 Subject: Use the new "column create" command and -defaultstyle widget option. --- demos/bitmaps.tcl | 7 +++++-- demos/demo.tcl | 10 +++++----- demos/explorer.tcl | 12 ++++++------ demos/help.tcl | 4 ++-- demos/imovie.tcl | 7 ++++++- demos/layout.tcl | 2 +- demos/mailwasher.tcl | 16 ++++++++-------- demos/outlook-folders.tcl | 2 +- demos/outlook-newgroup.tcl | 33 ++++++++++++++++++--------------- demos/random.tcl | 6 +++--- demos/www-options.tcl | 2 +- 11 files changed, 56 insertions(+), 45 deletions(-) diff --git a/demos/bitmaps.tcl b/demos/bitmaps.tcl index 9df6d8d..fe60b1e 100644 --- a/demos/bitmaps.tcl +++ b/demos/bitmaps.tcl @@ -9,7 +9,7 @@ proc DemoBitmaps {} { -selectmode browse -orient horizontal -wrap "5 items" \ -showheader no - $T column configure 0 -itembackground {gray90 {}} + $T column create -itembackground {gray90 {}} $T element create elemTxt text -fill [list $::SystemHighlightText {selected focus}] $T element create elemSelTxt rect -fill [list $::SystemHighlight {selected focus}] \ @@ -29,12 +29,15 @@ proc DemoBitmaps {} { $T style layout $S elemSelTxt -union elemTxt -ipadx 2 $T style layout $S elemTxt -expand we + # Set default item style + $T configure -defaultstyle [list $S] + set bitmapNames [list error gray75 gray50 gray25 gray12 hourglass info \ questhead question warning] foreach name $bitmapNames { set I [$T item create] - $T item style set $I 0 $S +# $T item style set $I 0 $S $T item text $I 0 $name $T item element configure $I 0 elemBmp -bitmap $name $T item lastchild root $I diff --git a/demos/demo.tcl b/demos/demo.tcl index d30da91..52e591e 100644 --- a/demos/demo.tcl +++ b/demos/demo.tcl @@ -251,17 +251,17 @@ proc MakeMainWindow {} { # Tree + scrollbar: demos TreePlusScrollbarsInAFrame .f1 0 1 .f1.t configure -showbuttons no -showlines no -showroot no -height 100 - .f1.t column configure 0 -text "List of Demos" -expand yes -button no + .f1.t column create -text "List of Demos" -expand yes -button no # Tree + scrollbar: styles + elements in list TreePlusScrollbarsInAFrame .f4 0 1 .f4.t configure -showroot no -height 140 - .f4.t column configure 0 -text "Elements and Styles" -expand yes -button no + .f4.t column create -text "Elements and Styles" -expand yes -button no # Tree + scrollbar: styles + elements in selected item TreePlusScrollbarsInAFrame .f3 0 1 .f3.t configure -showroot no - .f3.t column configure 0 -text "Styles in Item" -expand yes -button no + .f3.t column create -text "Styles in Item" -expand yes -button no .pw1 add .f1 .f4 .f3 -height 150 @@ -724,7 +724,7 @@ proc DemoClear {} { $T item delete all # Clear all bindings on the demo list added by the previous demo. - # This is why DontDelete it used for the binding. + # This is why DontDelete is used for the binding. foreach pattern [$T notify bind $T] { $T notify bind $T $pattern {} } @@ -756,7 +756,7 @@ proc DemoClear {} { -yscrollincrement 0 -itemheight 0 -showheader yes \ -background white -scrollmargin 0 -xscrolldelay 50 -yscrolldelay 50 \ -openbuttonimage "" -closedbuttonimage "" -backgroundmode row \ - -treecolumn 0 -indent 19 + -treecolumn 0 -indent 19 -defaultstyle {} # Restore default bindings to the demo list bindtags $T [list $T TreeCtrl [winfo toplevel $T] all] diff --git a/demos/explorer.tcl b/demos/explorer.tcl index 541a869..3c4b664 100644 --- a/demos/explorer.tcl +++ b/demos/explorer.tcl @@ -58,12 +58,12 @@ proc DemoExplorerDetails {} { InitPics small-* - $T column configure 0 -text Name -tag name -width 200 \ + $T column create -text Name -tag name -width 200 \ -arrow up -arrowpad 6 - $T column configure 1 -text Size -tag size -justify right -width 60 \ + $T column create -text Size -tag size -justify right -width 60 \ -arrowside left -arrowgravity right - $T column configure 2 -text Type -tag type -width 120 - $T column configure 3 -text Modified -tag modified -width 120 + $T column create -text Type -tag type -width 120 + $T column create -text Modified -tag modified -width 120 $T element create e1 image -image {small-folderSel {selected} small-folder {}} $T element create e2 text -fill [list $::SystemHighlightText {selected focus}] \ @@ -219,7 +219,7 @@ proc DemoExplorerLargeIcons {} { InitPics big-* - $T column configure 0 -width 75 + $T column create -width 75 $T element create elemImg image -image {big-folderSel {selected} big-folder {}} $T element create elemTxt text -fill [list $::SystemHighlightText {selected focus}] \ @@ -310,7 +310,7 @@ proc DemoExplorerList {} { InitPics small-* - $T column configure 0 -widthhack yes + $T column create -widthhack yes $T element create elemImg image -image {small-folderSel {selected} small-folder {}} $T element create elemTxt text -fill [list $::SystemHighlightText {selected focus}] \ diff --git a/demos/help.tcl b/demos/help.tcl index 0ee2125..0607906 100644 --- a/demos/help.tcl +++ b/demos/help.tcl @@ -14,7 +14,7 @@ proc DemoHelpContents {} { InitPics help-* - $T column configure 0 -text "Help Contents" + $T column create -text "Help Contents" # Define a new item state $T state define mouseover @@ -126,7 +126,7 @@ proc DemoHelpContents2 {} { InitPics help-* - $T column configure 0 -text "Help Contents" + $T column create -text "Help Contents" $T element create e1 image -image help-page $T element create e2 image -image {help-book-open {open} help-book-closed {}} diff --git a/demos/imovie.tcl b/demos/imovie.tcl index 0c99312..ac05335 100644 --- a/demos/imovie.tcl +++ b/demos/imovie.tcl @@ -9,6 +9,8 @@ proc DemoIMovie {} { -selectmode browse -orient horizontal -wrap window \ -showheader no -background #dcdcdc + $T column create + InitPics imovie-* switch -- $::thisPlatform { @@ -43,6 +45,9 @@ proc DemoIMovie {} { $T style layout $S elemRect -union {elemTime elemImg elemName} \ -ipadx 6 -padx {0 3} -pady {0 3} + # Set default item style + $T configure -defaultstyle [list $S] + for {set i 0} {$i < 5} {incr i} { foreach {time name image} { 15:20 "Clip 1" imovie-01 @@ -54,7 +59,7 @@ for {set i 0} {$i < 5} {incr i} { 07:20 "Clip 7" imovie-07 } { set I [$T item create] - $T item style set $I 0 $S +# $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 diff --git a/demos/layout.tcl b/demos/layout.tcl index f36da74..2e4f30e 100644 --- a/demos/layout.tcl +++ b/demos/layout.tcl @@ -8,7 +8,7 @@ proc DemoLayout {} { $T configure -showroot no -showrootbutton yes -showbuttons yes \ -showlines yes -itemheight 0 -selectmode browse - $T column configure 0 -text Layout + $T column create -text Layout $T element create e1 rect -width 30 -height 30 -fill gray20 $T element create e2 rect -width 30 -height 30 -fill gray40 \ diff --git a/demos/mailwasher.tcl b/demos/mailwasher.tcl index 33e856f..88b5475 100644 --- a/demos/mailwasher.tcl +++ b/demos/mailwasher.tcl @@ -16,14 +16,14 @@ proc DemoMailWasher {} { -xscrollincrement 1 set pad 4 - $T column configure 0 -text Delete -textpadx $pad -tag delete - $T column configure 1 -text Bounce -textpadx $pad -tag bounce - $T column configure 2 -text Status -width 80 -textpadx $pad -tag status - $T column configure 3 -text Size -width 40 -textpadx $pad -justify right -tag size - $T column configure 4 -text From -width 140 -textpadx $pad -tag from - $T column configure 5 -text Subject -width 240 -textpadx $pad -tag subject - $T column configure 6 -text Received -textpadx $pad -arrow up -arrowpad {4 0} -tag received - $T column configure 7 -text Attachments -textpadx $pad -tag attachments + $T column create -text Delete -textpadx $pad -tag delete + $T column create -text Bounce -textpadx $pad -tag bounce + $T column create -text Status -width 80 -textpadx $pad -tag status + $T column create -text Size -width 40 -textpadx $pad -justify right -tag size + $T column create -text From -width 140 -textpadx $pad -tag from + $T column create -text Subject -width 240 -textpadx $pad -tag subject + $T column create -text Received -textpadx $pad -arrow up -arrowpad {4 0} -tag received + $T column create -text Attachments -textpadx $pad -tag attachments $T element create border rect -open nw -outline gray -outlinewidth 1 \ -fill [list $::SystemHighlight {selected}] diff --git a/demos/outlook-folders.tcl b/demos/outlook-folders.tcl index d503721..6b7cafc 100644 --- a/demos/outlook-folders.tcl +++ b/demos/outlook-folders.tcl @@ -14,7 +14,7 @@ proc DemoOutlookFolders {} { $T configure -itemheight $height -selectmode browse \ -showroot yes -showrootbutton no -showbuttons yes -showlines yes - $T column configure 0 -text Folders + $T column create -text Folders $T element create e1 image $T element create e2 text -fill [list $::SystemHighlightText {selected focus}] \ diff --git a/demos/outlook-newgroup.tcl b/demos/outlook-newgroup.tcl index c8fb224..4cf52c0 100644 --- a/demos/outlook-newgroup.tcl +++ b/demos/outlook-newgroup.tcl @@ -16,13 +16,13 @@ proc DemoOutlookNewsgroup {} { $T configure -itemheight $height -selectmode browse \ -showroot no -showrootbutton no -showbuttons yes -showlines no - $T column configure 0 -image outlook-clip -tag clip - $T column configure 1 -image outlook-arrow -tag arrow - $T column configure 2 -image outlook-watch -tag watch - $T column configure 3 -text Subject -width 250 -tag subject - $T column configure 4 -text From -width 150 -tag from - $T column configure 5 -text Sent -width 150 -tag sent - $T column configure 6 -text Size -width 60 -justify right -tag size + $T column create -image outlook-clip -tag clip + $T column create -image outlook-arrow -tag arrow + $T column create -image outlook-watch -tag watch + $T column create -text Subject -width 250 -tag subject + $T column create -text From -width 150 -tag from + $T column create -text Sent -width 150 -tag sent + $T column create -text Size -width 60 -justify right -tag size # Would be nice if I could specify a column -tag too $T configure -treecolumn 3 @@ -66,6 +66,9 @@ proc DemoOutlookNewsgroup {} { $T style layout $S elemTxt -padx 6 -squeeze x -expand ns $T style layout $S sel.w -detach yes -iexpand es + # Set default item style + $T configure -defaultstyle [list "" "" "" s1 s2.we s2.we s2.w] + set msgCnt 100 set thread 0 @@ -121,7 +124,7 @@ proc DemoOutlookNewsgroup {} { } } - $T item style set $i 3 s1 4 s2.we 5 s2.we 6 s2.w +# $T item style set $i 3 s1 4 s2.we 5 s2.we 6 s2.w $T item text $i 3 $subject 4 $from 5 $sent 6 $size } @@ -185,13 +188,13 @@ proc DemoOutlookNewsgroup2 {} { $T configure -itemheight $height -selectmode browse \ -showroot no -showrootbutton no -showbuttons yes -showlines no - $T column configure 0 -image outlook-clip -tag clip - $T column configure 1 -image outlook-arrow -tag arrow - $T column configure 2 -image outlook-watch -tag watch - $T column configure 3 -text Subject -width 250 -tag subject - $T column configure 4 -text From -width 150 -tag from - $T column configure 5 -text Sent -width 150 -tag sent - $T column configure 6 -text Size -width 60 -justify right -tag size + $T column create -image outlook-clip -tag clip + $T column create -image outlook-arrow -tag arrow + $T column create -image outlook-watch -tag watch + $T column create -text Subject -width 250 -tag subject + $T column create -text From -width 150 -tag from + $T column create -text Sent -width 150 -tag sent + $T column create -text Size -width 60 -justify right -tag size $T configure -treecolumn 3 diff --git a/demos/random.tcl b/demos/random.tcl index 83b7d0c..25c0458 100644 --- a/demos/random.tcl +++ b/demos/random.tcl @@ -17,9 +17,9 @@ proc DemoRandom {} { -showroot yes -showrootbutton yes -showbuttons yes -showlines yes \ -scrollmargin 16 -xscrolldelay "500 50" -yscrolldelay "500 50" - $T column configure 0 -expand yes -text Item -itembackground {#e0e8f0 {}} -tag item - $T column configure 1 -text Parent -justify center -itembackground {gray90 {}} -tag parent - $T column configure 2 -text Depth -justify center -itembackground {linen {}} -tag depth + $T column create -expand yes -text Item -itembackground {#e0e8f0 {}} -tag item + $T column create -text Parent -justify center -itembackground {gray90 {}} -tag parent + $T column create -text Depth -justify center -itembackground {linen {}} -tag depth $T element create e1 image -image {folder-open {open} folder-closed {}} $T element create e2 image -image small-file diff --git a/demos/www-options.tcl b/demos/www-options.tcl index ea9ee12..00cdcb9 100644 --- a/demos/www-options.tcl +++ b/demos/www-options.tcl @@ -11,7 +11,7 @@ proc DemoInternetOptions {} { InitPics internet-* - $T column configure 0 -text "Internet Options" + $T column create -text "Internet Options" $T state define check $T state define radio -- cgit v0.12