Hi marioroy, I'm glad to see someone use Prima, as it is an under-appreciated toolkit. I did notice one unusual aspect of running your code. On my linux system, slackware, I notice a flickering in the $btn1 text as the background process runs. It almost looks like a "feature", indicating which step is active. :-)
Here is an unoptimized hack to fix the problem in the timer. It looks like this is a perfect opportunity to use a "state" variable in the timer, but this is just a brute force method, which makes it clear what is happening.
my $text = '';
my $timer = Prima::Timer->create(
timeout => 100, onTick => sub {
my $new_text = $msg->get;
if ($new_text ne $text){
$btn1->set( text => $new_text );
$text = $new_text;
}
}
);
-
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 How to display code and escape characters
are good places to start.
|