Sign in Join
Wiki copytemporary

TColorListBox: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11![](/wiki-images/8/8f/Tcolorlistbox_screenshot.png) A **TColorListBox** ![](/wiki-images/7/72/Tcolorlistbox.png) is a component that shows a (scrollable) list of colors from which the user can select one. It is available from the [[Additional tab]] of the [[Component Palette]].
22
33Specific properties of `TColorListBox` are:
44
55- `ColorRectOffset` - margin around each color rectangle
66- `ColorRectWidth` - width of a color rectangle
77- `Style` - defines the items shown in the listbox, and how the colors are named
88 - `cbStandardColors` - includes the 16 LCL standard colors in the list, e.g. `clRed` or `clBlue`
99 - `cbExtendedColors` - includes the 4 LCL extended colors: `clMoneyGreen`, `clSkyBlue`, `clCream`, `clMedGray`
1010 - `cbSystemColors` - includes the OS- and theme-dependent system colors
1111 - `cbIncludeNone` - includes the special color `clNone`. Use the property `NoneColorColor` to determine the replacement color. If `NoneColorColor` is set to `clNone` the color rectangle displays a crossed-out box like in many drawing programs.
1212 - `cbIncludeDefault` - include the special color `clDefault`. Property `DefaultColorColor` determines the actual color displayed.
1313 - `cbCustomColor` - the first listbox item is customizable by means of the standard color dialog.
1414 - `cbPrettyNames` - displays "pretty" color names next to the color boxes, e.g. 'Red'. Without this option the internal color names are used, e.g. 'clRed'.
1515 - `cbCustomColors` - includes user-provided colors at the end of the list. The colors must be defined by a stringlist in the `OnGetColors` event, like this:
1616
1717``` Pascal
1818 procedure TForm1.ColorListBox1GetColors(Sender: TCustomColorListBox; Items: TStrings);
1919 begin
2020 Items.AddObject('Gold', TObject(PtrInt($00D7FF)));
2121 Items.AddObject('Chocolate', TObject(PtrInt($1E69D2)));
2222 Items.AddObject('Light blue', TObject(PtrInt($E6D8AD)));
2323 end;
2424```
2525
26-\
2726==See also==
2827
2928- [[doc:lcl/colorbox/tcolorlistbox.html|TColorListBox doc]]
3029- [[TColorBox]]
3130- [[TListBox]]
3231
3332---
3433*From the Free Pascal wiki, page "TColorListBox", as it stood on 2019-08-02 after a change by Wp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history