Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomColorComboBoxProperties.OnNamingConvention Event

In This Article

Enables you to specify the text description of each color represented by the control.

#Declaration

Delphi
property OnNamingConvention: TcxNamingConventionEvent read; write;

#Remarks

The textual descriptions of items in the color combo box depends upon the following settings – the Properties.NamingConvention and Properties.ColorValueFormat properties of the editor and the Description property of items. These settings can all be overridden by handling the OnNamingConvention event. This event is extremely useful if you want to construct or modify descriptions for each item in a consistent manner. For instance, you may need to remove the ‘cl‘ prefix from descriptions when the Delphi naming convention is applied. Another example is to display color descriptions in a hexadecimal format with a ‘#‘ prefix as in HTML.

The Sender parameter of the event identifies the control that raised the event. The AColor parameter enables you to determine the color whose description is to be modified or constructed. The AColorDescription parameter holds the color description specified by the settings mentioned above. You can modify it or assign it a new value to change the text representation of the color.

The sample code below shows you how to display descriptions for all colors in hexadecimal format with a ‘#‘ prefix.

Delphi
procedure TForm1.cxColorComboBox1PropertiesNamingConvention(
  Sender: TObject; const AColor: TColor; var AColorDescription: string);
begin
  AColorDescription := '#' + IntToHex(AColor, 6);
end;

The result of handling the event in this manner is shown in the image below.

See Also