TColorListBox: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 |  A **TColorListBox**  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]]. | |
| 2 | 2 | ||
| 3 | 3 | Specific properties of `TColorListBox` are: | |
| 4 | 4 | ||
| 5 | 5 | - `ColorRectOffset` - margin around each color rectangle | |
| 6 | 6 | - `ColorRectWidth` - width of a color rectangle | |
| 7 | 7 | - `Style` - defines the items shown in the listbox, and how the colors are named | |
| 8 | 8 | - `cbStandardColors` - includes the 16 LCL standard colors in the list, e.g. `clRed` or `clBlue` | |
| 9 | 9 | - `cbExtendedColors` - includes the 4 LCL extended colors: `clMoneyGreen`, `clSkyBlue`, `clCream`, `clMedGray` | |
| 10 | 10 | - `cbSystemColors` - includes the OS- and theme-dependent system colors | |
| 11 | 11 | - `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. | |
| 12 | 12 | - `cbIncludeDefault` - include the special color `clDefault`. Property `DefaultColorColor` determines the actual color displayed. | |
| 13 | 13 | - `cbCustomColor` - the first listbox item is customizable by means of the standard color dialog. | |
| 14 | 14 | - `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'. | |
| 15 | 15 | - `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: | |
| 16 | 16 | ||
| 17 | 17 | ``` Pascal | |
| 18 | 18 | procedure TForm1.ColorListBox1GetColors(Sender: TCustomColorListBox; Items: TStrings); | |
| 19 | 19 | begin | |
| 20 | 20 | Items.AddObject('Gold', TObject(PtrInt($00D7FF))); | |
| 21 | 21 | Items.AddObject('Chocolate', TObject(PtrInt($1E69D2))); | |
| 22 | 22 | Items.AddObject('Light blue', TObject(PtrInt($E6D8AD))); | |
| 23 | 23 | end; | |
| 24 | 24 | ``` | |
| 25 | 25 | ||
| 26 | - | ||
| 27 | 26 | ==See also== | |
| 28 | 27 | ||
| 29 | 28 | - [[doc:lcl/colorbox/tcolorlistbox.html|TColorListBox doc]] | |
| 30 | 29 | - [[TColorBox]] | |
| 31 | 30 | - [[TListBox]] | |
| 32 | 31 | ||
| 33 | 32 | --- | |
| 34 | 33 | *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).* |
