Re: ftextLines and the detached message display

Chris Garrigues <[email protected]> Thu, 03 Feb 2005 14:39:58 -0600
Newsgroups gmane.mail.exmh.devel
Message-ID <[email protected]>
> From:  Brent Welch <[email protected]>
> Date:  Fri, 21 Jan 2005 21:39:37 -0800
>
> 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.

Your untested code was close enough for me to figure out.  The only odd thing 
is that now ExwinFixupFtextLines gets called repeatedly while you resize the 
window.  I'm going to leave it like that for now since I'm not noticing any
issues caused by it.

Chris

-- 
Chris Garrigues                         Trinsic Solutions
President                               1611-B West 6th Street
                                        Austin, TX  78703-5074

512-322-0180                            http://www.trinsics.com

                 Would you rather proactively pay for
                uptime or reactively pay for downtime?

                          Trinsic Solutions
                 Your Proactive IT Management Partner

_______________________________________________
Exmh-workers mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/exmh-workers
signature.asc (application/pgp-signature, 235 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Exmh version 2.2_20000822 06/23/2000

iD8DBQFCAoweK9b4h5R0IUIRAnrcAJ0cy2JRIwCUtrs62/7ksfjVx2y7rgCeOFHy
v+flhoCICGwp+yxrRgE0NFM=
=4gtq
-----END PGP SIGNATURE-----