Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-04

TTimer on design time

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

I'm doing some some controls that uses TTimer. I don't know why, but from some time ago, TTimer don't fire the OnTimer procedure. I see in their source and is wrote:

procedure TCustomTimer.UpdateTimer;
begin
  KillTimer;
  if (FEnabled) and (FInterval > 0)
  and (([CSDESIGNING,csLoading,csDestroying]*ComponentState=[]))
  and Assigned (FOnTimer) then begin
    //DebugLn(['TCustomTimer.UpdateTimer ',dbgsName(Self),'
WidgetSet.CreateTimer']);
    FTimerHandle := WidgetSet.CreateTimer(FInterval, @Timer);
    if FTimerHandle=0 then begin
      FTimerHandle:=cIdNoTimer;
      raise EOutOfResources.Create(SNoTimers);
    end;
    if Assigned(OnStartTimer) then OnStartTimer(Self);
  end;
end;

So, what's the problem of fire OnTimer on Design time? Maybe I'm wrong, but at least version 0.9.29 fires this event at design time.

Regards,

Fabio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110419/ed71c4d9/attachment.html>

Reply by email

Vincent Snijders
to Unknown author

2011/4/19 :

Show quoted text 22 lines
I'm doing some some controls that uses TTimer. I don't know why, but from some time ago, TTimer don't fire the OnTimer procedure. I see in their source and is wrote: procedure TCustomTimer.UpdateTimer; begin ? KillTimer; ? if (FEnabled) and (FInterval > 0) ? and (([CSDESIGNING,csLoading,csDestroying]*ComponentState=[])) ? and Assigned (FOnTimer) then begin ? ? //DebugLn(['TCustomTimer.UpdateTimer ',dbgsName(Self),' WidgetSet.CreateTimer']); ? ? FTimerHandle := WidgetSet.CreateTimer(FInterval, @Timer); ? ? if FTimerHandle=0 then begin ? ? ? FTimerHandle:=cIdNoTimer; ? ? ? raise EOutOfResources.Create(SNoTimers); ? ? end; ? ? if Assigned(OnStartTimer) then OnStartTimer(Self); ? end; end; So, what's the problem of fire OnTimer on Design time? Maybe I'm wrong, but at least version 0.9.29 fires this event at design time.

I am not sure, but
Assigned (FOnTimer) returns always false at design time. But this is from before 0.9.28, with the removal of JitForms, see http://wiki.lazarus.freepascal.org/Lazarus_0.9.28_release_notes#IDE_changes

See also the code change in TCustomTimer.SetOnTimer.

Vincent

Reply by email