So are you saying something like this???

$close=1;
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=0;}

After I build the exe using perl2exe and click on exit it still gives me an 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 I will see it on the console window. However, it is not quitting the program. How do I do that???

Normally, you exit the Win32::GUI::Dialog event loop with the 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 DoEvents. So it's up to you to keep track of when you should exit that 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 the window to indicate "keep on running". $W->Enable(0) in the menu or button event handler perhaps?


/J

------ ---- --- -- -- -- -  -   -    -        -
Johan Lindström                    Boss Casinos
Sourcerer                     [EMAIL PROTECTED]
                 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
Perl-Win32-GUI-Users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

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


Reply via email to