Win32::GUI::DoEvents() did the trick!

Thanks for everyone's help!  Have a great weekend!

--
Andy Pastuszak
Desktop Engineer II
Commerce Bank
[EMAIL PROTECTED]
(856)470-3270




Robert May <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
05/05/2006 04:12 PM

 
        To:     Andrew M Pastuszak <[EMAIL PROTECTED]>
        cc:     perl-win32-gui-users@lists.sourceforge.net
        Subject:        Re: [win32-gui] [perl-win32-gui-users] Progress Bar Not 
Displaying


Andrew M Pastuszak wrote:
> I am having a problem, with the progress bar not displaying in a window. 

> Here is my subroutine.  Feel free to offer any comments you want about 
> cleaning up this code:

Without *short*, *complete*, and *runnable* code example that 
demonstrates your problem it is very difficult to help.  In making your 
code example runnable I end up with something that runs fine.

Here's what I cut your code down to:

#!perl -w
use strict;
use warnings;

use Win32::GUI();

my $progress = Win32::GUI::Window->new(
     -title => 'Conversion Progress',
     -name  => 'Progress',
     -size  => [450,125],
);

$progress->AddProgressBar(
     -name => 'PB',
     -size => [400,20],
     -pos  => [0,20],
);

$progress->AddStatusBar(
     -name => 'SB',
);

$progress->PB->SetRange(0,100);
$progress->Center();
$progress->Show();

foreach (1 .. 100) {
     $progress->PB->SetPos($_);
     $progress->SB->Text("$_");
     #Win32::GUI::DoEvents();   # See later in email
     Win32::Sleep(100);
}

$progress->Hide();

exit(0);
__END__

As I said, it runs fine, and the progress bar is displayed.  The only 
thing that I can see that you might want to do is add a 
Win32::GUI::DoEvents() call during the loop, so that all windows 
messages get processed - otherwise things like paint messages are not 
handled (try moving another window across the front of the progress 
window, while it is running).

Regards,
Rob.


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job 
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/





____________________________
This message and any attachments may contain confidential or privileged 
information and are intended only for the use of the intended recipients of 
this message.  If you are not the intended recipient of this message, please 
notify the sender by return email, and delete this and all copies of this 
message and any attachments from your system.  Any unauthorized disclosure, 
use, distribution, or reproduction of this message or any attachments is 
prohibited and may be unlawful.
____________________________

Reply via email to