Try using a _Timer instead of the while loop.
> -----Original Message----- > From: Marcus [mailto:[EMAIL PROTECTED] > Sent: 16 November 2001 12:09 > To: perl-win32-gui-users@lists.sourceforge.net > 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 > Perl-Win32-GUI-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >