For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > January 2005 > Seeking resize solutions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Seeking resize solutions
Dean Arnold

2005-01-10, 3:58 pm

(WinXP, AS 5.8.3, TK 804.027 + patches)

Hoping someone can help; this is a bit of a repost of an issue
I had with DynaTabFrame back during the Tk804 beta that has reared
its head again. Note that the issue occured on both WinXP and
Linux, so I'm inclined to believe its either something silly
in my code, or something odd in pTk itself.

I'm trying to redraw the tabs for DTF when the window is resized,
stacking/unstacking as needed. Initially, I was having an issue with
just the width being incremented by 12 pixels in a vicious cycle,
ie,

- get the Config event
- post a debounce timer (so I'm not redrawing everything all the time),
- then redraw when the timer fires.

All well and good, except after the initial redraw, even when there
are no tabs to draw, I get "phantom" Config events that seem to
recycle the same width/height increments,
which causes my redraws to keep expanding the window ad nauseum,
even if there are no tabs defined.
I managed to solve this by using a width threshold of 13 pixels,
so these phantoms would be ignored (tho I think that's been
causing another issue).

Now I'm trying to implement support for tabs on the sides, which
would require redrawing when the window height changes, and I'm
getting the phantoms again, except that the recycled heights
don't seem quite as predictable as the width, and are relatively
large (50 - 80 pixels).

Does anyone have a solution to this issue that will
clamp the Config events ? My debouncer doesn't seem to help,
regardless of the delay I use. As far as sample code, I can
only point to the current Tk::DynaTabFrame - just look
at ConfigDebounce() and reduce the width threshold below
13.

TIA,
Dean Arnold
Presicient Corp.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
Dean Arnold

2005-01-10, 3:58 pm

Dean Arnold wrote:
> (WinXP, AS 5.8.3, TK 804.027 + patches)
>
> Hoping someone can help; this is a bit of a repost of an issue
> I had with DynaTabFrame back during the Tk804 beta that has reared
> its head again. Note that the issue occured on both WinXP and
> Linux, so I'm inclined to believe its either something silly
> in my code, or something odd in pTk itself.
>


After much frustration and fiddling, I've got it working, tho
I have no idea why it behaves as it does.

The problem and solution (FWIW):
As part of drawing tab rows, I append a "pseudo"
tab at the end to give the illusion that the tabs are embedded
in a row. Initially, I destroyed and recreated these pseudo tabs
whenever the tabs were rearranged. Note that these pseudotabs
are very simple, just a frame w/ an empty label, and some border
decoration. However, for some reason, the destruction and recreation
of these pseudotabs during a window resize *while the mouse button
was still pressed on the resizer* would cause the window to snap
back to its original dimensions.

The only way I've been able to solve this is to impose some arbitrary
limit on the number of tab rows (currently 20), and precreate the pseudo
tabs when the DTF is created, then place() them as needed during a
redraw event. I spose it may improve redraw processing time, but
I'd certainly love to hear if anyone can explain why pTk behaves this
way.

This fix seems to have also eliminated the constant stream of Config
events.

Dean Arnold
Presicient Corp.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com