LCL, Grids: fix thumbtracking focusrect issues when scrolling, issue #35812

(cherry picked from commit a4db7e4e62)
This commit is contained in:
Jesus Reyes A 2021-08-03 10:15:37 -05:00
parent 8a1d2d8a2f
commit f3bd9119d6
2 changed files with 16 additions and 3 deletions

View File

@ -3225,13 +3225,22 @@ begin
end;
procedure TCustomDBGrid.DrawFocusRect(aCol, aRow: Integer; ARect: TRect);
var
DrawBits: Byte;
begin
// Draw focused cell if we have the focus
if Self.Focused and (dgAlwaysShowSelection in Options) and
FDatalink.Active and DefaultDrawing then
begin
DrawBits := BF_RECT;
if (dgRowSelect in Options) then begin
if (LeftCol>FixedCols) or (GCache.TLColOff<>0) then
DrawBits := DrawBits and not BF_LEFT;
if (GCache.VisibleGrid.Right<ColCount-1) then
DrawBits := DrawBits and not BF_RIGHT;
end;
CalcFocusRect(aRect);
DrawRubberRect(Canvas, aRect, FocusColor);
DrawRubberRect(Canvas, aRect, FocusColor, DrawBits);
end;
end;

View File

@ -10750,8 +10750,12 @@ begin
Canvas.Pen.Mode := pmXOR;
end;
DrawBits := BF_RECT;
if (goRowSelect in Options) and ((fTopLeft.x<>FixedCols) or (FGCache.TLColOff<>0)) then
DrawBits := DrawBits and not BF_LEFT;
if (goRowSelect in Options) then begin
if ((fTopLeft.x>FixedCols) or (FGCache.TLColOff<>0)) then
DrawBits := DrawBits and not BF_LEFT;
if (FGCache.VisibleGrid.Right<ColCount-1) then
DrawBits := DrawBits and not BF_RIGHT;
end;
DrawRubberRect(Canvas, aRect, FFocusColor, DrawBits);
if FUseXORFeatures then begin
Canvas.Pen.Mode := OldPenMode;