How do I make the Object Inspector show more TColor property values?
Asked Answered
S

1

6

The IDE Object Inspector shows TColor properties with a drop-down ColorBox, and the color can be selected by name - clBlack etc, as defined in the Graphics unit. The problem is that the clWeb colors also defined in the Graphics unit are not present, and any custom colors I define are also not there.

So how do I extend the defined colors that are selectable in the Object Inspector?

PS Delphi XE

Surmullet answered 4/1, 2011 at 23:57 Comment(4)
Are the colors shown for the Color property of other controls, besides the one you wrote? Is this a question about your custom component, or about how to add new colors in general?Gingery
The same color list is present on, say , a TColorBox dropped onto a VCL form. Custom defined colors are present in the code completion window in the editor, but are not present in the Object Inspector.Surmullet
I see. Since your question isn't related to your custom component, I've removed that part of your question. Also, the Code Completion window is showing you the clWeb colors because it's really showing you all integer constants — you've just already typed cl before you looked at the list. TColor is just an integer; there's nothing inherently special about those constants. It's the built-in TColor property editor that knows to display those specific values.Gingery
I will revert to this issue when I get a chance to investigate further. My development machine (a laptop) died a sudden and horrible death, and I am still setting up a new machine..Surmullet
F
1

I would try to derive a class from TColorProperty (unit VCLEditors) and override GetValue/GetValues/SetValue. See here for a detailed discussion.

Edit: My original link is broken by now. Try the thread Custom colors in Delphi 7 (in borland.public.delphi.vcl.components.writing.general) instead.

Fossorial answered 5/1, 2011 at 8:14 Comment(2)
Ah, that does look promising. Thanks.Surmullet
@UlrichGerhardt - That link is now broken. Goes to an Embarcadero page that says "The specified message [93199] was not found."Candlestick

© 2022 - 2024 — McMap. All rights reserved.