From 184161ed726e304d36ed4c2dad5918eb002b96e2 Mon Sep 17 00:00:00 2001 From: treectrl Date: Sat, 4 Jun 2005 23:38:22 +0000 Subject: Examine -padx and -ipadx of -union elements when calculating max width of the text widget. Remove the binding from the entry/text widget if they are destroyed. --- library/filelist-bindings.tcl | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/library/filelist-bindings.tcl b/library/filelist-bindings.tcl index ea512ec..ed2743a 100644 --- a/library/filelist-bindings.tcl +++ b/library/filelist-bindings.tcl @@ -359,6 +359,19 @@ proc ::TreeCtrl::FileListEdit {T I C S E} { } else { set pade [set padw $padx] } + foreach E2 [$T style elements $S] { + if {[lsearch -exact [$T style layout $S $E2 -union] $E] == -1} continue + foreach option {-padx -ipadx} { + set pad [$T style layout $S $E2 $option] + if {[llength $pad] == 2} { + incr padw [lindex $pad 0] + incr pade [lindex $pad 1] + } else { + incr padw $pad + incr pade $pad + } + } + } TextExpanderOpen $T $I $C $E [expr {$x2 - $x1 - $padw - $pade}] # Single-line edit @@ -592,6 +605,9 @@ proc ::TreeCtrl::EntryExpanderOpen {T item column element} { TreeCtrl::EntryClose %T 0 focus $TreeCtrl::Priv(entry,%T,focus) } + bind $T.entry { + [winfo parent %W] notify bind %W {} + } $T.entry configure -font $font -background [$T cget -background] $T.entry insert end $text @@ -711,6 +727,9 @@ proc ::TreeCtrl::TextOpen {T item column element {width 0} {height 0}} { TreeCtrl::TextClose %T 0 focus $TreeCtrl::Priv(text,%T,focus) } + bind $T.text { + [winfo parent %W] notify bind %W {} + } $T.text tag configure TAG -justify [$T element cget $element -justify] $T.text configure -font $font @@ -791,6 +810,9 @@ proc ::TreeCtrl::TextExpanderOpen {T item column element width} { TreeCtrl::TextClose %T 0 focus $TreeCtrl::Priv(text,%T,focus) } + bind $T.text { + [winfo parent %W] notify bind %W {} + } $T.text tag configure TAG -justify $justify $T.text configure -font $font -background [$T cget -background] @@ -806,10 +828,10 @@ proc ::TreeCtrl::TextExpanderOpen {T item column element width} { "%d %d" width height set tbw [$T.text cget -borderwidth] - set tx [expr {$x1 - $tbw - 1}] - place $T.text -x $tx -y [expr {$y1 - $tbw - 1}] \ - -width [expr {$width + ($tbw + 1) * 2}] \ - -height [expr {$height + ($tbw + 1) * 2}] \ + incr tbw + place $T.text -x [expr {$x1 - $tbw}] -y [expr {$y1 - $tbw}] \ + -width [expr {$width + $tbw * 2}] \ + -height [expr {$height + $tbw * 2}] \ -bordermode outside focus $T.text @@ -855,10 +877,11 @@ proc ::TreeCtrl::TextExpanderKeypress {T} { "%d %d" width height set tbw [$T.text cget -borderwidth] + incr tbw place configure $T.text \ - -x [expr {$center - $width / 2 - $tbw - 1}] \ - -width [expr {$width + ($tbw + 1) * 2}] \ - -height [expr {$height + ($tbw + 1) * 2}] + -x [expr {$center - ($width + $tbw * 2) / 2}] \ + -width [expr {$width + $tbw * 2}] \ + -height [expr {$height + $tbw * 2}] $T.text tag add TAG 1.0 end -- cgit v0.12