[Lazarus] Type casting problem

Mattias Gärtner nc-gaertnma at netcologne.de
Sat Sep 5 12:13:11 CEST 2009


Zitat von claude <claude.pomalo at free.fr>:

> Hello
>
> i'm trying to port a small delphi componant that i use in one app  
> ported to Lazarus.
> The componentnt build without problem with *{$MODE DELPHI}* but when  
> i'm in Lazarus ide, if i close a form containing this component, i  
> give a violation access  error  in my component This error does not  
> occur runnig the application stand alone.
>
> I have try to build the component in FPC mode but the compilation   
> fail with error:
>
> Error: Illegal type conversion: "Int64" to "TFont"
>
> in line
>
> Result := TFont(GetOrdProp(Component, ptrPropInfo)));
>
>
> of the function
>
> function GetCompFont(Component : TComponent) : TFont;
> var ptrPropInfo : PPropInfo;
> begin
>  ptrPropInfo := GetPropInfo(Component.ClassInfo, 'Font');
>  if ptrPropInfo = nil then
>     Result := nil
>  else
>      Result := TFont(GetOrdProp(Component, ptrPropInfo)));

Maybe:
TFont(GetObjectProp(Component,PropInfo,TFont));


> end;
>
>
> maybe in delphi mode the type casting is wrong getPropInfo return an Int64


Mattias






More information about the Lazarus mailing list