Re: refresh+update on macosx

Steve Cookson - gmail <[email protected]>
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <[email protected]>
Hi Eric,

I had a similar case with updating a progress bar during a database 
update.  The answer is $app->Yield();

In your case if you make the $app variable global and add $app->Yield() 
to the loop, it works (at least on Linux):


sub OnInit {

     our $app = shift;

.
.
.
.
.

sub addTxt {
     my $p=shift;
     our $app;
     foreach (1..30) {
         $p->{TERM}->AppendText("another line $_\n");
         $p->{TERM}->Refresh;
         $p->Update;
         $app->Yield();
         print "$_\n";
         sleep 1;
         }

Regards

Steve.

On 10/11/14 20:53, Erik Colson wrote:
> Hi,
>
> The code in the attached file is working nicely on Windows XP. i.e. when
> clicking on 'add text' it adds a line to the textctrl each second. On
> Macosx the same code only shows the added 30 lines once execution hits
> the event loop. Any idea why this happens ?
>
> best
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.