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

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467
HMcG
  • 2,062
  • 4
  • 24
  • 36
  • 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? – Rob Kennedy Jan 05 '11 at 04:49
  • 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. – HMcG Jan 05 '11 at 10:49
  • 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. – Rob Kennedy Jan 05 '11 at 15:21
  • 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.. – HMcG Jan 15 '11 at 10:51

1 Answers1

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.

Uli Gerhardt
  • 13,748
  • 1
  • 45
  • 83