> Try using a _Timer instead of the while loop.
Wayyyy to much effort, although it would be the "correct" way to handle
this. If you just put a Win32::GUI::DoEvents() inside your loop, the user
can click around and events get fired while the script is running.

HOWEVER, bear in mind that the event handlers do run inside your loop, so
you must still implement a way to end the loop after a Cancel_Click. See my
posting "RE: some basic questions" (last thursday) for a code snippet.


> -----Original Message-----
> From: Marcus [mailto:[EMAIL PROTECTED]
> Sent: 16 November 2001 12:09
> To: [email protected]
> Subject: [perl-win32-gui-users] Cancel action requests
> 
> 
> I hope somebody can help on this one. I need to use a cancel button so
> the user can break out of a routine which is running. Problem is, the
> button cannot be pressed until the action has completed.
> 
> Run this and you'll see that as long as the loop is counting, the
> button click event will not respond. Can this be changed so that the
> click event is checked beforehand?
> 
> 
> use Win32::GUI;
> 
> $win = new Win32::GUI::Window(
>       -name => 'MainWindow',
>       -size => [200, 200],
>       );
> 
> $win->AddButton(
>       -name => "CancelButton",
>       -text => "Cancel",
>       -left => 50,
>       -top => 100,
>       );
> 
> $win->Show();
> 
> # Just print some numbers, updating the window so that the button
> remains visible.
> 
> for my $i (0..1500) {print "$i,"; $win->Update();}
>               
>       Win32::GUI::Dialog();
> 
>       return(1);
> 
> 
> sub ::CancelButton_Click {
> 
> print "Cancel request.\n";
> }
> 
> 
> __END__
> 
> 
> Thanks,
> 
> Marcus
> 
> 
> 
> 
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
> 

_______________________________________________
Perl-Win32-GUI-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

Reply via email to