Skip to content
Permalink
Browse files

Highlight same grid cell text also in current row, not only in curren…

…t column. Closes #707
  • Loading branch information...
ansgarbecker committed Oct 30, 2019
1 parent 4b39eeb commit 83e06020e467164eb860aad0b0ede657a4243aec
Showing with 15 additions and 12 deletions.
  1. +15 −12 source/main.pas
@@ -9784,18 +9784,21 @@ procedure TMainForm.AnyGridBeforeCellPaint(Sender: TBaseVirtualTree;

// Probably display background color on fields with same text
// Result pointer gets moved to the focused node.. careful!
if (Sender.FocusedNode <> nil) and (Node <> Sender.FocusedNode) and (Column = Sender.FocusedColumn) then begin
clSameData := AppSettings.ReadInt(asHightlightSameTextBackground);
if clSameData <> clNone then begin
FieldText := r.Col(Column);
CurrentIsNull := r.IsNull(Column);
RowNumber := Sender.GetNodeData(Sender.FocusedNode);
r.RecNo := RowNumber^; // moving result cursor
FocusedFieldText := r.Col(Column);
FocusedIsNull := r.IsNull(Column);
if (CompareText(FieldText, FocusedFieldText) = 0) and (CurrentIsNull = FocusedIsNull) then begin
TargetCanvas.Brush.Color := clSameData;
TargetCanvas.FillRect(CellRect);
if (Sender.FocusedNode <> nil) then begin
if ((Node <> Sender.FocusedNode) and (Column = Sender.FocusedColumn))
or ((Node = Sender.FocusedNode) and (Column <> Sender.FocusedColumn)) then begin
clSameData := AppSettings.ReadInt(asHightlightSameTextBackground);
if clSameData <> clNone then begin
FieldText := r.Col(Column);
CurrentIsNull := r.IsNull(Column);
RowNumber := Sender.GetNodeData(Sender.FocusedNode);
r.RecNo := RowNumber^; // moving result cursor
FocusedFieldText := r.Col(Sender.FocusedColumn);
FocusedIsNull := r.IsNull(Sender.FocusedColumn);
if (CompareText(FieldText, FocusedFieldText) = 0) and (CurrentIsNull = FocusedIsNull) then begin
TargetCanvas.Brush.Color := clSameData;
TargetCanvas.FillRect(CellRect);
end;
end;
end;
end;

0 comments on commit 83e0602

Please sign in to comment.
You can’t perform that action at this time.