[Lazarus] How to obtain the "real" color of a control @runtime?

zeljko zeljko at holobit.net
Tue Dec 23 08:35:22 CET 2014


On 12/22/2014 11:30 PM, Mattias Gaertner wrote:
> On Mon, 22 Dec 2014 18:49:58 +0100
> Bart <bartjunk64 at gmail.com> wrote:
>
>> Hi,
>>
>> I'm trying to obtain the "real" color of a control (TEdit) at runtime.
>> The color at design time is set to clDefault ($20000000), but I need
>> to get the RGB value (which in this case should be $FFFFFF, since with
>> the current theme the default color of a TEdit on my OS is white).
>> I need this s I can have another control paint in that same color on
>> it's canvas.
>
> What platform, Lazarus version, widgetset?
>
>
>> ColorToRGB just gave me $0, whic is not what I'm looking for.
>
> The background can be an image, gradient or whatever. So on some themes
> this might be the correct result.

No, clDefault is incorrect at any time. To obtain color we have:
     function GetColorResolvingParent: TColor;
     function GetRGBColorResolvingParent: TColor;

zeljko


> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>





More information about the Lazarus mailing list