The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....

Using TColSel

The visual component TColSel supports the selection of user defined colors from a combo box. The combo box may be loaded with up to 64 colors, which can be edited by the user. By default, the standard Windows colors are loaded.

In order to set up a particular table of selectable colors you have to specify the number of entries by defining the property NumColors and then fill the color table (properties Colorsand ColorNames) with the desired colors. A few standard color tables can be loaded by the following methods: LoadBasicVGAPalette, LoadExtendedPalette, LoadStandardPalette and LoadWindowsSystemPalette.

The colors are displayed in the drop-down box both as colored rectangles and by their respective names (or the corresponding RGB value in hexdecimal notation if the color has no associated name). The width of the colored rectangle can be controlled by the property ColorBarWidth, the length of the drop-down list can be specified by the property DropDownCount.

You can switch individual color entries into an editable mode which allows to redefine the corresponding color by the user. The property ColorEditAllowed allows to controll the editing on an individual level, the methods ResetAllColorEditFlags and SetAllColorEditFlags control the editing option for all available colors.

The color selected by the user can be read either as color value (property SelColor) or as string using the property SelColorID. The method FindColorEntry allows searching for a specific entry in the color table.

Last Update: 2023-Dec-15