Re: ftextLines and the detached message display
Brent Welch <[email protected]> Fri, 21 Jan 2005 21:39:37 -0800
| Newsgroups | gmane.mail.exmh.devel |
|---|---|
| Message-ID | <[email protected]> |
Yeah, I noticed this too, and punted. The problem is there is
no easy way to ask the Tk text widget how many lines are displayed.
Well, it isn't impossible, but you have to reverse engineer it by
asking what the index is at a particular X, Y location based on
the window size.
So, I think the "right" think is to bind something to the Configure event
on a window. That is triggered when the window changes size. That bit
of code should be something like (I haven't tested this)
bind $exwin(ftoc) <Configure> FtocDeduceSize
proc FtocDeduceSize {} {
global exwin
set h [winfo height $exwin(ftext)]
set w [winfo width $exwin(ftext)]
set ix [$exwin(ftext) index @[expr $height-1],[expr $width-1] ]
set exwin(ftextLines) [lindex [split $ix .] 0]
}
You pretty much have to use the same algorithm whenever you want to
do this, and binding to the Configure event means you only do it
when the window changes size.
>>>Chris Garrigues said:
> I noticed that $exwin(ftextLines) is pretty much guaranteed to not match the
> actual size of the ftoc window if the message window is detached. There are
> some places in the code which refer to this variable and therefore don't do
> the right thing. The one I noticed was in Ftoc_Change.
>
> It's not clear to me what the correct answer is for that. Should a resize o
f
> the window cause the variable to be recomputed, or should code like
> Ftoc_Change ignore the variable and figure out the actual size of the window
> on the fly?
>
> Any thoughts?
--
Brent Welch
Software Architect, Panasas Inc
Delivering the premier storage system for scalable Linux clusters
www.panasas.com
[email protected]