From: Louis B. <lb...@li...> - 2001-07-02 12:43:36
|
So are you saying something like this??? $close=3D1; while (1) { some code... Win32::GUI::DoEvents() while Win32::GUI::PeekMessage(0,0,0); exit(0) if !$W->IsEnabled(); exit(0) if $W->Enable($close); } exit(0); sub Exit_Click {$close=3D0;} After I build the exe using perl2exe and click on exit it still gives me an= =20 error. Louis At 01:55 PM 7/2/2001 +0200, Johan Lindstrom wrote: >Louis wrote: >>sub Exit_Click {$W->PostQuitMessage(0);} >> >>Now I know that this sub is executing because I can put a print in it and= =20 >>I will see it on the console window. However, it is not quitting the=20 >>program. How do I do that??? > >Normally, you exit the Win32::GUI::Dialog event loop with the=20 >PostQuitMessage, or by returning -1 from an event handler (more common). > >But, you don't use the Dialog sub, you use your own main loop, using=20 >DoEvents. So it's up to you to keep track of when you should exit that=20 >loop using a flag of some sort. For example, you have > > exit(0) if !$W->IsEnabled(); > >So, the proper thing in this case would be to use the Enable() status of=20 >the window to indicate "keep on running". $W->Enable(0) in the menu or=20 >button event handler perhaps? > > >/J > >------ ---- --- -- -- -- - - - - - >Johan Lindstr=F6m Boss Casinos >Sourcerer jo...@ba... > http://www.bahnhof.se/~johanl/ >If the only tool you have is a hammer, >everything tends to look >like a nail > > >_______________________________________________ >Perl-Win32-GUI-Users mailing list >Per...@li... >http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users -- =A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0= =BA=A4=F8,=B8=B8,=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... =A4=B0`=B0http://www.lightbridge.com =A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0= =BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 |