View Issue Details

IDProjectCategoryView StatusLast Update
0033042LazarusLCLpublic2018-04-17 20:36
ReporterMike JonesAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86-64OSWindowsOS Version10
Product VersionProduct Build 
Target Version1.8.4Fixed in Version1.9 (SVN) 
Summary0033042: In TDrawGrid, when UseXORFeatures property is true, no focus rectangle is shown.
DescriptionI 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 Informationprocedure 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;
TagsNo tags attached.
Fixed in Revision57661
LazTarget1.8.4
Widgetset
Attached Files

Activities

Jesus Reyes

2018-04-17 20:36

developer   ~0107835

Fixed

Issue History

Date Modified Username Field Change
2018-01-17 04:19 Mike Jones New Issue
2018-01-17 10:35 Marco van de Voort Project FPC => Lazarus
2018-01-20 21:03 Jesus Reyes Assigned To => Jesus Reyes
2018-01-20 21:03 Jesus Reyes Status new => assigned
2018-04-17 20:36 Jesus Reyes Fixed in Revision => 57661
2018-04-17 20:36 Jesus Reyes LazTarget => 1.8.4
2018-04-17 20:36 Jesus Reyes Note Added: 0107835
2018-04-17 20:36 Jesus Reyes Status assigned => resolved
2018-04-17 20:36 Jesus Reyes Fixed in Version => 1.9 (SVN)
2018-04-17 20:36 Jesus Reyes Resolution open => fixed
2018-04-17 20:36 Jesus Reyes Target Version => 1.8.4