[Lazarus] TTimer on design time

Vincent Snijders vincent.snijders at gmail.com
Tue Apr 19 20:39:16 CEST 2011

2011/4/19 fluisgirardi at gmail.com <fluisgirardi at gmail.com>:
> 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

See also the code change in TCustomTimer.SetOnTimer.


More information about the Lazarus mailing list