From: Andrew K. <aki...@gs...> - 2001-06-27 13:03:17
|
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 aki...@gs...=20 >>> lb...@li... 06/27/01 08:34AM >>> Help please, I am trying get this program to completely terminate when I click on the = X=20 in the top right hand corner but it is not working. I have played = around=20 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 =3D new Win32::GUI::Window( -title =3D> "Win32::GUI::Louis Test", -left =3D> 100, -top =3D> 100, -width =3D> 200, -height =3D> 150, -font =3D> $F, -name =3D> "Window", ); $tX =3D 5; $W->AddLabel( -name =3D> "Fatal_Label", -text =3D> "Fatal:", -left =3D> $tX, -top =3D> 5, ); $tX =3D 5; $tY +=3D $W->Fatal_Label->Height + 10; $W->AddLabel( -name =3D> "Warning_Label", -text =3D> "Warning:", -left =3D> $tX, -top =3D> $tY, ); $tX_Fatal +=3D $W->Fatal_Label->Width + 27; $tX_Warning +=3D $W->Warning_Label->Width + 10; $W->Show; for ($i =3D 0; $i <=3D10; $i++) { $W->AddTextfield( -name =3D> "Fatal_Text", -left =3D> $tX_Fatal, -top =3D> 5, -width =3D> 80, -height =3D> 20, -text =3D> $i, ); $W->AddTextfield( -name =3D> "Warning_Text", -left =3D> $tX_Warning, -top =3D> $tY, -width =3D> 80, -height =3D> 20, -text =3D> "test2", ); print "$i\n"; Win32::GUI::PeekMessage(0,0,0); Win32::GUI::DoEvents() < 0; sleep(2); } sub W_Terminate {-1;} -- =A4=A4=BA=B0`=B0=BA=A4=F8, ,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA= =A4=F8, ,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 =A4=B0`=B0Lightbridge, Inc =A4=B0`=B067 South Bedford St. =A4=B0`=B0Burlington MA 01832 =A4=B0`=B0781.359.4795 mailto:lb...@li...=20 =A4=B0`=B0http://www.lightbridge.com=20 =A4=A4=BA=B0`=B0=BA=A4=F8, ,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA= =A4=F8, ,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li...=20 http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |