Your skill will accomplish
what the force of many cannot
Refreshing text without flicker with AddLabel using Win32::GUIby Popcorn Dave (Abbot)
|on Dec 02, 2006 at 07:06 UTC||Need Help??|
Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
I'm still relatively new to the world of Win32::GUI and so I'm trying to port a working Tk stock price app that I wrote. BBFU was kind enough to point me to the direction of Timer for the timed calling of a subroutine, but now I'm stumped by the actual act of refreshing text labels.
In my Tk program, I write the labels, and when I go to refresh, I replace them all with blank lines, then rewrite them. Maybe not the best way to do it, but in Tk I'm not noticing any delay in the "erasing" and the "rewriting".
My first thought was to write a small test app to see if I could figure this out, but I'm stumped as to why once the string is at it's max length, it won't "erase" the extra bits when fed a smaller string.
Now when translating this to my stock price app, I've got 8-10 stocks that I'm watching, and obviously as prices flucuate, I'm going to be stung by having something at +.90 perhaps go to +1.12, then down to +.81 and I'm going to have extra characters that are still being displayed.
In my stock app I'm displaying the initial results like this:
where test is a quote delimited string returned from Yahoo Finance. I'm not bothering with Text::CSV as it's never returning anything with an embedded apostrophe in it.
So when I want to update the information, I'm using the same technique but blank lines instead of the data that I'm scraping.
Is there a better way to go about displaying the data in one fell swoop that I've missed? If so, can someone point me to either the spot in the docs or some kind of tutorial?
Thanks in advance!
Revolution. Today, 3 O'Clock. Meet behind the monkey bars.