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 :)

Timer
The Timer object is a special kind of control: it has no appearance, its
only purpose is to trigger an event every specified amount of time. 

The synopsis to create a Timer object is: 


        new Win32::GUI::Timer( PARENT, NAME, ELAPSE )



        PARENT->AddTimer( NAME, ELAPSE )


NAME
the name for the Timer object (used to lookup the associated event). 

ELAPSE
the number of milliseconds after which the Timer() event will be
triggered. 

Once you've created the Timer object, you can change the ELAPSE
parameter with the Interval() method, or disables it with the Kill()
method. Note that Kill(), despite of its name, does not destroy the
Timer object, so you can re-enable it later with Interval(). 

Example: 


        # creates a Timer that is called every 1 second
        
        $Window->AddTimer( "Clock", 1000 );



        sub Clock_Timer {
                print "one second passed.\n";
        }


Methods: Interval, Kill 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Dennis Putnam
Sent: Saturday, July 19, 2003 11:19 PM
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Click subroutine doesn't get control
when script is executing



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a script that is started by a button. It can be a long process
and I 
would like to give the user the option of cancelling execution at any
time. 
Unfortunately, it seems that when the script is running all buttons
become 
disabled or at least the click events are never allowed to get control.

How do I set up a cancel button and click event that can interrupt
script 
processing? TIA.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
Comment: Be sure to use my most recent key -  created 6/16/03

iQA/AwUBPxoKC/34lmKmdrVUEQKNqgCg7wi6hsuC0pqoA+Bl0oxB6/DtswgAn1Te
JDvHL8SgVGlC7tIJXR5zXvZI
=1L53
-----END PGP SIGNATURE-----




-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users



Reply via email to