View Issue Details

IDProjectCategoryView StatusLast Update
0001988JEDI VCL00 JVCL Componentspublic2004-07-27 09:50
ReporteranonymousAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001988: JvTimerList: OnTimer Event don't work with default Interval (1000)
Description1. Add JvTimerList on form
2. Create new Event and don't change Interval=1000
3. Create some "OnTimer" Event
4. After compilation: Event "OnTimer" never rise
Additional InformationOnly default value 1000 do not work. Change to 999 correct the problem.
TagsNo tags attached.

Activities

cpall

2004-07-20 22:28

reporter   ~0004786

It would strike me that changing TJvTimerEvent.Create() so that instead of
fEnabled := True

to

fEnabled := False;
SetEnabled(True);

Would have the same consequence as setting it just to true, but also trip the enabling code. This is a small kludge. I'm a bit befuddled why the handle is being reset in the notify code to a "valid" handle (NextHandle) when it is not being set to a valid windows handle. If this weren't the case, you might be able to enable the timer in the SetInterval procedure by checking whether it was enabled but not valid. This would also be a slight kludge. Ah. Maybe the best solution would be to override loaded and then insure all of the timers are running there. Is that what should be done here?

I uploaded the slight kludge anyway.

2004-07-20 22:28

 

JvTimerList.pas (19,535 bytes)

anonymous

2004-07-21 06:47

viewer   ~0004788

My workaround for 1000ms is:
- Disable timer in design time and enable it in runtime during OnShow event.
It works well. I do it for any timer from JvTimerList.

I think it should be corrected in component but it is difficult to tune it for me
because I am BCB user.

obones

2004-07-22 12:36

administrator   ~0004802

The actual change is to the line where FInterval is set.
Instead of

FInterval := DefaultInterval;

use

Interval := DefaultInterval;

This works here on the quick demo application I did, let me know if it also works on your application

AHUser

2004-07-22 12:42

developer   ~0004803

Fixed in CVS.

I have added virtual Loaded method to the JvTimerEvent class that is called by the TJvTimerList.Loaded method and does the initialization with Interval and Enabled.

obones

2004-07-22 23:58

administrator   ~0004813

The change is Loaded is pretty much useless if people create timers at runtime.

The only change that I think works is the one I proposed and by the way, there only is a need to set the interval, Enabled is not useful (AFAIK).

anonymous

2004-07-23 01:49

viewer   ~0004814

Just do it your way. It as late when I had written this bug fix and had not thought about runtime creation.

anonymous

2004-07-23 05:07

viewer   ~0004815

Yeah, and I was concerned that setting it in the constructor would end up causing the timer to get created twice (no leak, just twice). I don't know that this is that big of a deal, so long as the timer is executed, it's a small matter.

cpall

2004-07-23 05:08

reporter   ~0004816

Last anonymous was me.

obones

2004-07-23 06:23

administrator   ~0004819

Did you try my fix (the one in the constructor)?
Does it work?

If yes, I'll investigate the "double" creation, but there is a code to prevent that in the property setter (If FInterval <> Value)

korecek

2004-07-26 04:03

reporter   ~0004832

>>Did you try my fix (the one in the constructor)?
Yes, I did.

>>Does it work?
Yes it does.
It works very well for me. No problem.
Timer is created in design time...

I cannot say anything to latest "cpall" note. :-(

{BTW: I added the bug.)

cpall

2004-07-26 19:50

reporter   ~0004836

Long story short, It worked and I'm not concerned anymore about it calling multiple times, this is a small issue, so long as it doesn't leak, that's the important thing, and I don't believe it does. I've wasted more time than the extra calls to that code will waste even if recreated hundreds upon thousands of times.

It worked for me, and as far as calling it multiple times, it did. It called it once when it was just setting the member variable directly (but didn't enable the event, when I used a non-default timer, it called it twice (and worked), but when it set the property and not the variable it set it three times. Which again, leads me to ask - so what?

Resolved!

obones

2004-07-27 09:50

administrator   ~0004838

I'm happy with the fix and users are happy too. This bug is now resolved

Issue History

Date Modified Username Field Change
2004-07-20 20:03 anonymous New Issue
2004-07-20 22:28 cpall Note Added: 0004786
2004-07-20 22:28 cpall File Added: JvTimerList.pas
2004-07-21 06:47 anonymous Note Added: 0004788
2004-07-22 12:36 obones Note Added: 0004802
2004-07-22 12:36 obones Assigned To => obones
2004-07-22 12:36 obones Status new => feedback
2004-07-22 12:42 AHUser Status feedback => resolved
2004-07-22 12:42 AHUser Resolution open => fixed
2004-07-22 12:42 AHUser Note Added: 0004803
2004-07-22 23:58 obones Status resolved => feedback
2004-07-22 23:58 obones Resolution fixed => reopened
2004-07-22 23:58 obones Note Added: 0004813
2004-07-23 01:49 anonymous Note Added: 0004814
2004-07-23 05:07 anonymous Note Added: 0004815
2004-07-23 05:08 cpall Note Added: 0004816
2004-07-23 06:23 obones Note Added: 0004819
2004-07-26 04:03 korecek Note Added: 0004832
2004-07-26 19:50 cpall Note Added: 0004836
2004-07-27 09:50 obones Status feedback => resolved
2004-07-27 09:50 obones Resolution reopened => fixed
2004-07-27 09:50 obones Note Added: 0004838