There are at least two hardcoded colors in the grid components that are not published properties. One of them (FocusColor) is already public (but not published) and the other one does not yet exist.
- FocusColor is the red color of the dotted rectangle around the selected cell
- The proposed RowHighlightColor would be the background color of a selected row when the flag goRowHighlight is in the options set
This question here is 2-fold:
(1) Is it acceptable to add a new property RowHighlightColor?
(2) Should these two afforementioned properties be published?
The RowHighlight was hardcoded by xoring the background with $1F1F1F, I extended this functionality it as such:
@@ -3881,7 +3893,10 @@ procedure TCustomGrid.PrepareCanvas(aCol, aRow: Integer; aState: TGridDrawState)
end;
end;
if (gdRowHighlight in aState) and not (gdFixed in AState) then
- Result := ColorToRGB(Result) xor $1F1F1F
+ if FRowHighlightColor = clDefault then
+ Result := ColorToRGB(Result) xor $1F1F1F
+ else
+ Result := FRowHighlightColor;
end;
var
AColor: TColor;
The rest of the patch is property declarations and a setter.
The patch is still incomplete since it only publishes it for TStringGrid, not for the other grids.
Please tell me whether I should proceed in this direction.