Oppss, typo on the "last" example.  Forgot the !.  Should read:

last if !$W->IsEnabled();

Andrew

>>> [EMAIL PROTECTED] 06/27/01 09:02AM >>>
When you click the X, you send a terminate to the "window" loop but your for 
loop is still going since it doesn't know about the window being terminated.  I 
don't know if this is the best solution, but you could add:

exit if !$W->IsEnabled();

just before the sleep (2) command.  Therefore, when your window goes away, your 
script will exit.  If you just want to exit the for loop and continue use:

last if $W->IsEnabled();

Andrew Kincaid
Lead PC Systems Specialist, IS&T
Georgia State University
[EMAIL PROTECTED] 


>>> [EMAIL PROTECTED] 06/27/01 08:34AM >>>
Help please,

I am trying get this program to completely terminate when I click on the X 
in the top right hand corner but it is not working.  I have played around 
with a few different ways to use peekmessage and doevents with no luck.

Can some one help me.  I do not see anything in the archives like this.

Thanks,
Louis

use Win32::GUI;
$W = new Win32::GUI::Window(
     -title    => "Win32::GUI::Louis Test",
     -left     => 100,
     -top      => 100,
     -width    => 200,
     -height   => 150,
     -font     => $F,
     -name     => "Window",
);
$tX = 5;
$W->AddLabel(
     -name => "Fatal_Label",
     -text => "Fatal:",
     -left => $tX,
     -top  => 5,
);
$tX = 5;
$tY += $W->Fatal_Label->Height + 10;
$W->AddLabel(
     -name => "Warning_Label",
     -text => "Warning:",
     -left => $tX,
     -top  => $tY,
);
$tX_Fatal += $W->Fatal_Label->Width + 27;
$tX_Warning += $W->Warning_Label->Width + 10;
$W->Show;
for ($i = 0; $i <=10; $i++)
{

    $W->AddTextfield(
     -name   => "Fatal_Text",
     -left   => $tX_Fatal,
     -top    => 5,
     -width  => 80,
     -height => 20,
     -text   => $i,
    );
    $W->AddTextfield(
     -name   => "Warning_Text",
     -left   => $tX_Warning,
     -top    => $tY,
     -width  => 80,
     -height => 20,
     -text   => "test2",
    );
    print "$i\n";
    Win32::GUI::PeekMessage(0,0,0);
    Win32::GUI::DoEvents() < 0;
    sleep(2);
}
sub W_Terminate {-1;}


--
¤¤º°`°º¤ø,  ,ø¤º°`°º¤øø¤º°`°º¤ø,  ,ø¤º°`°º¤øø¤º°`°º¤
¤°`°Lightbridge, Inc
¤°`°67 South Bedford St.
¤°`°Burlington MA 01832
¤°`°781.359.4795 mailto:[EMAIL PROTECTED] 
¤°`°http://www.lightbridge.com 
¤¤º°`°º¤ø,  ,ø¤º°`°º¤øø¤º°`°º¤ø,  ,ø¤º°`°º¤øø¤º°`°º¤


_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net 
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users 


_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net 
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users


Reply via email to