Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

TColor RTTI issue

edited November 2003 in General
Hi,

It seems it never work if I have the following code in the GetPropRec
method for TColor-type properties:

GetPropRec method:

if CompareText(APropName, 'Color') = 0 then
EnumPropToRec(APropName, 'TColor', False, APropRec)

If you try to set any color value to this Color property, it didn't work at
all !


but it worked if the code change to:

if CompareText(APropName, 'Color') = 0 then
PropToRec(APropName, daInteger, False, APropRec)

It worked without any problem by setting any color value to this Color
property !. e.g. Color := clYellow, clRed, ...

so What am I missing?


Thanks

William

Comments

  • edited November 2003
    Hi William,

    The reason EnumPropToRec is not working is that the TColor type is not an
    Enumerated type. The TColor type is more like an integer and the specific
    color definitions (ie. clRed, clBlue) are more like constants. Search
    TColor in the Delphi help for more information on this.

    In RAP some of these constants are defined for some of the most commonly
    used colors so this is why it is working when setting the color to clYellow
    or clRed.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Nico Cizik (Digital Metaphors) wrote:


    Thanks, Nico. I was reading the source code of ppCTMain, in the
    TraTppElementRTTI.GetPropRec method, it used EnumPropToRect(aPropName,
    'TColor', False, aPropRec). so it should be a bug then.

    Best Regards,

    William
  • edited November 2003
    Hi William,

    Thanks for pointing that out. I'll take a look at that and get it fixed.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.