[Lazarus] fpGUI Widget Type: TTimer fix

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Aug 31 10:09:44 CEST 2011



On Wed, 31 Aug 2011, Michael Schnell wrote:

> (using Linux X86 32 Bit):
>
> Initiating TTimer with fpGUI Widget Type issues a Range check error: Project 
> eventtest raises exception class 'RunError(201)'
>
>
>
> line 153  is
>
>
> Result := PtrInt(Timer);
>
>
> PtrInt in fact is "LongInt".
> When stepping my example the value for the Timer variable is $B761AA00.
> So the Longint will be negative and as THandle is PtrUInt which again is 
> DWord, a range check exception is raised.
>
> Changing the line to
>
>
> Result := THandle(Timer);
>
>
> makes the Timer work in my example
>
> I don't know if this is appropriate for all Archs....

I think
  Result := PtrUint(Timer);
is better and safer. THandle has a 'windows-only' ring to it.

Michael.




More information about the Lazarus mailing list