Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OnGetColors event not firing for TColorBox

Tags:

colors

delphi

I am trying to add a custom color to a TColorBox control. I've added the control to my form and for the Style property, set cbCustomColor to True. For the OnGetColors event, I have the following code:

procedure TfrmAbout.GetColors(Sender: TCustomColorBox; Items: TStrings);
begin
  ShowMessage('GetColors has been triggered');
  Items.AddObject('clWebSnow',TObject(clWebSnow));
  Items.AddObject('MyOrange',TObject(Rgb(255,128,0)));
end;

I don't see the messagebox or the colors appearing in the dropdown. Is there anything else I need to do in order to get this to work?

like image 351
ikathegreat Avatar asked Dec 04 '25 18:12

ikathegreat


1 Answers

You need to include the cbCustomColors option to the Style property to enable adding of your own custom colors instead. The cbCustomColor option only includes the item, which allows you to select a custom color.

like image 72
TLama Avatar answered Dec 06 '25 07:12

TLama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!