[Lazarus] How to stream TColor in hexadecimal format?

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Apr 14 02:08:31 CEST 2015


On Mon, 13 Apr 2015 23:49:50 +0200
Vojtěch Čihák <vojtech.cihak at atlas.cz> wrote:

>[...]
> how to stream TColor in hexadecimal format?
>  
> Currently, TColor is streamed as
>  
> Color = 5810431
> Color = clTeal
>  
> in *.lfm or

As far as I know the underlying TAbstractObjectWriter does not
support hexadecimal.

  
> <integer name="ClrDWBCurve" value="33023"/>
> <ident name="ClrSF2Curve" value="clRed"/>
>  
> in *.xml.
> How can I stream it in $00FEDCBA format?
>  
> In the worst case, I probably can move those properties from published to public and TPersistent.DefineProperties.
> Will it work? 

No, because that uses TAbstractObjectWriter too.

> Or is there some more elegant way?

Maybe you can overload
  RegisterIntegerConsts(TypeInfo(TColor), TIdentToInt(@IdentToColor),
TIntToIdent(@ColorToIdent)); 
with your own functions and write colors as "h00FEDCBA".

Mattias




More information about the Lazarus mailing list