In TDrawGrid, when UseXORFeatures property is true, no focus rectangle is shown.
Original Reporter info from Mantis: fude
-
Reporter name: Mike Jones
Original Reporter info from Mantis: fude
- Reporter name: Mike Jones
Description:
I have found the problem and have fixed it on my system. In TCustomDrawGrid.DrawFocusRect, the pen is set to clBlack and pen mode set to pmXOR. Black XOR any value will return the same value, therefore, no focus rectangle is visible. I changed the value to clWhite and recompiled and it works as expected, since white XOR any color value returns its inverse. I have included the offending routine from grids.pas in the Additional Information section.
Additional information:
procedure TCustomDrawGrid.DrawFocusRect(aCol, aRow: Integer; ARect: TRect);
var
OldFocusColor: TColor;
OldPenMode: TFPPenMode;
DrawBits: Byte;
begin
// Draw focused cell if we have the focus
if DefaultDrawing and (Self.Focused or
(EditorAlwaysShown and ((Feditor=nil) or not Feditor.Focused))) then
begin
CalcFocusRect(aRect);
if FUseXORFeatures then begin
Canvas.SaveHandleState;
OldFocusColor := FFocusColor;
FFocusColor:= clBlack;//White not visible on White background
OldPenMode:=Canvas.Pen.Mode;
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;
DrawRubberRect(Canvas, aRect, FFocusColor, DrawBits);
if FUseXORFeatures then begin
Canvas.Pen.Mode := OldPenMode;
Canvas.RestoreHandleState;
FFocusColor := OldFocusColor;
end;
end;
end;
Mantis conversion info:
- Mantis ID: 33042
- OS: Windows
- OS Build: 10
- Platform: x86-64
- Version: 2.3 (SVN)
- Fixed in version: 1.9 (SVN)
- Fixed in revision: 57661 (#00d16819)
- Target version: 1.8.4