You could easy work around it - use a global to skip execution of the
code in your _Timer subroutine every second time it runs i.e.:

Sub MyTimer_Timer {
        $count ++;
        if (($count % 2) == 1) {
                # do Timer code here
        }
}

Not nice, but neither is DoEvents running events twice :/

Every two time this runs, it will do work once.

Cheers,

--
Iain Whyte
infrastructure and systems manager
Fortis Clearing Sydney Pty Ltd
Ph: +61 2 92336497
Fx: +61 2 92364440
Mb: 0419793593
Em: [EMAIL PROTECTED] 



-----Original Message-----
From: Christian Kappler [mailto:[EMAIL PROTECTED] 
Sent: Monday, 14 April 2003 6:33 AM
To: Perl-Win32-GUI Mailinglist
Subject: Re: [perl-win32-gui-users] Timer-Object-Question


Hello Sean,

On Friday, April 11, 2003 3:40 PM, "Sean Healy" <[EMAIL PROTECTED]>
wrote:
> >I found that the _Timer subroutine was called twice in succession 
> >every second. What is it I am doing wrong?
>
> Are you by any chance using Win32::GUI::DoEvents in a loop instead of 
> Win32::GUI::Dialog?  I (and others) have noticed that DoEvents seems 
> to respond to events twice, i.e., touching a single key puts the same
character
> twice into a textfield.  Since a Timer fires off an event, it would
probably
> respond to it twice.

Yes, this is true. I use Win32::GUI::DoEvents() in a while loop to work
through the events. The Win32::GUI::Timer is to update the contents of a
DialogBox which is on top of a window which uses the
Win32::GUI::Dialog() method for user interaction. In the while loop I do
some printing to hard disc and the DialogBox is to show the progress of
this action. I found that I needed to call Win32::GUI::DoEvents in the
loop otherwise there is no proper updating of the content of the
DialogBox, even that there had been a call to Win32::GUI::Dialog()
before (to manage the main window). So for me it seems that I have to
use Win32::GUI::DoEvents().

You mean that I can't do anything against the timer getting fired twice,
instead of once, every second in this context?

Regards,

  Christian

*** Christian Kappler ***






-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The
debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost
and 
disoriented. TotalView can help you find your way. Available on major
UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users


=========================================================================
This e-mail is sent for the sole attention of the identified addressee
and its contents are provided for information purposes only. Fortis 
Clearing Sydney Pty Ltd makes no warranty or representation as to the 
accuracy and completeness of any information and does not assume whatever
commitment hereby. Legally binding obligations can only arise for, or be 
entered into on behalf of, Fortis Clearing Sydney Pty Ltd by means of 
a written instrument, signed by two duly authorised representatives of 
Fortis Clearing Sydney Pty Ltd. Fortis Clearing Sydney Pty Ltd excludes 
any liability whatsoever for any direct or consequential loss arising 
from the use of, or reliance on, this e-mail or its contents.
=========================================================================


Reply via email to