Skip to content

Commit

Permalink
Highlight same grid cell text also in current row, not only in curren…
Browse files Browse the repository at this point in the history
…t column. Closes #707
  • Loading branch information
ansgarbecker committed Oct 30, 2019
1 parent 4b39eeb commit 83e0602
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions source/main.pas
Expand Up @@ -9784,18 +9784,21 @@ procedure TMainForm.AnyGridBeforeCellPaint(Sender: TBaseVirtualTree;


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

0 comments on commit 83e0602

Please sign in to comment.