Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
That's a great idea! I was thinking I could perhaps "destroy" the label and recreate it every time but that seemed a bit much to have to do. Since that label is the same size, overwriting it should be okay.


Worked like a charm!

Surprisingly enough, it doesn't seem to complain that you've got two labels in the same place, and will actually update depending on which one you choose.

use strict; use Win32::GUI; use constant COLOR => '#F4F2E8'; my ($redraw, $count); $count = 0; my $main = Win32::GUI::Window->new( -name => 'Main', -text => 'Redraw Test', -width => 200, -height => 100, -background => COLOR, -onTimer => \&redraw, ); my $arrow_font = Win32::GUI::Font->new( -name => "Wingdings", -size => 28, -bold => 1, ); $main->AddTimer( "redraw", 500 ); my $uparrow = $main->AddLabel( -text => ' ', -left => 55, -font => $arrow_font, -foreground => [255,0,0], -background => COLOR, -top => 10, ); my $dnarrow = $main->AddLabel( -text => ' ', -left => 55, -font => $arrow_font, -foreground => [0,255,0], -background => COLOR, -top => 10, ); $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate { -1; } sub redraw{ $count++; if ($count%2){ $dnarrow->Text(chr(233)); } else {$uparrow->Text(chr(234));} }

The only thing that I found didn't work is to put '' in the text for the initial label. Once I changed that to ' ' all worked just fine.

Thanks again for the idea!

Revolution. Today, 3 O'Clock. Meet behind the monkey bars.

In reply to Re^4: Refreshing text without flicker with AddLabel using Win32::GUI by Popcorn Dave
in thread Refreshing text without flicker with AddLabel using Win32::GUI by Popcorn Dave

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2021-12-06 20:40 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (33 votes). Check out past polls.