DBAdvGrid & Color Column

I'm using a dbadvgrid with a dataset that has a numeric color colummn .
edColorPickerDropDown is working well. Color values are being saved & retrieved.
But I could not make the grid show a color instead of the column value as a number.
Also tried adding a shape to the cells, but nothing changed.
For the grid's columns there's no "ColorField" property as there are ImageField,ProgressField,PictureField.

What's the right way to have DB color selection using a DBAdvGrid ? (and display colors at the cell, not text)

Thanks

Have you tried using the OnGetCellColor event and from this event handler use the cell's value to set the parameter ABrush.Color / AFont.Color to the value in the cell?

Yes.
Just thought that once it has a native support of a colorpicker, there would be a native Way to show colors.
OnGetCellColor does not fire when the Cell is selected, so it won't get the event custom colors.

I had to make a little dialog for editting the record, and then using a dumb cell just to show the selected color (using on cell get color), with a hidden cell pointing to it's db field. (and also disabling rowselect to avoid SelectedAppearance to override custom color when anoither cell at the same row is selected)

Selected cells have by default the selection color, unless you use the grid.SelectionColorMixer feature to determine the % of selection color that shows through the regular cell background color.

1 Like