I just know you're going to start asking how to put progress bars in there.
Basically, there's a way of obtaining the rectangle of a specific part
($statusbar->GetRect($part)). I'm pretty sure that to insert a progress bar
into the status bar you simply make a new progress bar with the status bar as
it's parent window, and position and size it using the values returned by
GetRect.
Here's an example that shows a progress bar filling and unfilling in the status
bar.
use Win32::GUI;
use Time::HiRes qw( time );
my $window = new Win32::GUI::Window(
-name => "main",
-text => "Status Progress",
-size => [300,300],
-pos => [100,100],
-onResize => \&main_resize
);
my $status = new Win32::GUI::StatusBar($window);
$status->Parts(200,-1);
my $progress = new Win32::GUI::ProgressBar($status, -smooth => 1);
$progress->SetRange(0,1000);
$window->Show;
while(1) {
Win32::GUI::DoEvents;
$progress->SetPos( int((1 + sin(time)) * 500) );
}
sub main_resize {
$status->Width($window->ScaleWidth);
$status->Top($window->ScaleHeight - $status->Height);
my($left,$top,$right,$bottom) = $status->GetRect(1);
$progress->Left($left);
$progress->Top($top);
$progress->Width($right - $left);
$progress->Height($bottom - $top);
}
__END__
Steve
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Chris Wearn
> Sent: 19 January 2004 10:15
> To: [email protected]
> Subject: RE: [perl-win32-gui-users] Statusbar example
>
>
> Hi Steve, Jez,
>
> Thanks Steve. Now its all clear ;-) Got confused with the
> MSDN which had
> Parts(nParts[array of widths]). Should have spotted the X
> co-ordinate in
> 'x1' Doh!
>
> And now Jez has answered my next question with his post,
> which was how are
> the parts referenced... hours of fun coming up, another late
> night I feel
> ;-)
>
> Cheers
>
> Chris
>
> -----Original Message-----
> From: Stephen Pick [mailto:[EMAIL PROTECTED]
> Sent: Monday, 19 January 2004 5:49 PM
> To: Chris Wearn; [email protected]
> Subject: RE: [perl-win32-gui-users] Statusbar example
>
>
> Hi,
>
> The correct usage is:
>
> $status->Parts(x1,x2,x3,x4,x5...);
>
> I'm sorry if the docs were confusing. This takes a list, not a list
> reference. Also it does not take "widths", it takes the X
> co-ordinate of the
> right-hand edge of each part. This is true to the actual API
> functionality,
> which is kind of weird but is actually quite handy. So, to
> create 3 parts
> each of width 100 pixels, you would use:
>
> $status->Parts(100,200,300);
>
> Hope that helps out,
>
> Steve
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]
> Behalf Of
> > Chris Wearn
> > Sent: 19 January 2004 06:30
> > To: [email protected]
> > Subject: [perl-win32-gui-users] Statusbar example
> >
> >
> > Hi All
> >
> > Having trouble with the new Statusbar additions:
> >
> > tried different combinations of PARTS to start dividing, but
> > no matter what
> > I've tried nothing seems to work. What order do the methods
> need to be
> > called?
> >
> > I've had a look at MSDN Status Bars and read the notes that
> > Steve posted on
> > announcing the enhancements. Confused in that MSDN says
> that Parts is
> > (nParts[array of widths])
> >
> > I've tried $Window_Status->Parts([200,100,-1]); and
> > Parts(3,[200,100,-1])
> >
> > Can someone add a few of the methods to the example below.
> >
> > Chris
> >
> >
> > # ============================
> >
> > use Win32::GUI;
> >
> > my $Window = new GUI::Window(
> > -title => "Statusbar example",
> > -left => 100,
> > -top => 100,
> > -width => 400,
> > -height => 200,
> > -name => "Window",
> > -events =>{
> > Terminate => sub { return -1 },
> > }
> > );
> >
> > # Add a Status Bar
> > my $Window_Status = $Window->AddStatusBar(
> > -name => "Window_Status",
> > -text => "Panel 1"
> > );
> >
> > $Window->Show;
> > Win32::GUI::Dialog;
> >
> >
> >
> > -------------------------------------------------------
> > The SF.Net email is sponsored by EclipseCon 2004
> > Premiere Conference on Open Tools Development and Integration
> > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> > http://www.eclipsecon.org/osdn
> > _______________________________________________
> > Perl-Win32-GUI-Users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> >
>
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>