> -----Original Message----- > From: Dennis Putnam [mailto:[EMAIL PROTECTED] > Sent: Sunday, July 20, 2003 10:00 AM > To: perl-win32-gui-users@lists.sourceforge.net > Subject: RE: [perl-win32-gui-users] Click subroutine doesn't > get control > when script is executing > > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > At 03:58 AM 7/20/2003, you wrote: > >In the typiucal windows way (which we can do in PERL), is to start a > >TIMER. > >The classic to this approach is a "setup" pogram with the > prograss bar. > > > >When you start your script, you will need to set a WM_TIMER for some > >time slice, > >eg, every 2 seconds. > > > >If you're building your own GUI, then before the > >WitEvent/DoModal/Whatever, you;ll want > >to put it in there. > > > > > >Here's the Win32::GUI package's description...Hope this helps out :) > > SNIP > > Thanks for the reply, it might. However, it is not clear what > I do in the > timer event. Should it just be a NOOP so that the event > simply interrupts > processing (do I even need it)? If a button click has > occurred will the > click event will be triggered or do I need to check something > in the timer > event to see if the button was clicked? > >
Forget the timer ( in this situation) sub Button_click { my $var =1; while ($var) #####long running loop { #### Do somestuff here and then repeat Win32::GUI::DoEvents(); $var =0; } } "JUDICIOUS" use of DoEvents will help as long as you are not actually running a blocking I/O type call such as waiting on an open socket for data. If you are just doing alot of single actions in a loop, then DoEvents is what you need. I would even suggest building a cancel button on your page that is hidden until the loop stuff is started. Of course, if you do that, you need to make sure that $var is in a scope that will pass into Button_click and stop the execution on its next check. Joe