TColor RTTI issue
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
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
This discussion has been closed.
Comments
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.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
Thanks for pointing that out. I'll take a look at that and get it fixed.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com