View Issue Details

IDProjectCategoryView StatusLast Update
0027213LazarusLCLpublic2017-08-21 13:20
ReporterMichlAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOS7OS Version64bit
Product Version1.3 (SVN)Product Build47221 
Target Version1.8Fixed in Version1.9 (SVN) 
Summary0027213: Size of TCustomGrid ButtonStyle cbsButtonColumn isn't correct
DescriptionThe size of the drawed Button in a cell is not correct. I've only tested Win7.
Steps To ReproduceSimple run the attached example
Additional InformationI've asked in the German Lazarusforum of the behavior on other OS without a feedback. Please test the added patch on other platforms before apply. A possible patch can also be:

...
procedure TCustomGrid.DrawButtonCell(const aCol, aRow: Integer; aRect: TRect;
  const aState: TGridDrawState);
var
  details: TThemedElementDetails;
begin
  {$IFDEF MSWINDOWS}
  Dec(aRect.Right);
  Dec(aRect.Bottom);
  {$ELSE}
  InflateRect(aRect, -2, 0);
  {$ENDIF}
  if gdPushed in aState then
...
Tagspatch
Fixed in Revision54784
LazTarget1.8
WidgetsetWin32/Win64
Attached Files
  • TestDrawGrid.zip (3,448 bytes)
  • grids.pas.patch (776 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 47221)
    +++ lcl/grids.pas	(working copy)
    @@ -4250,7 +4250,8 @@
     var
       details: TThemedElementDetails;
     begin
    -  InflateRect(aRect, -2, 0);
    +  Dec(aRect.Right);
    +  Dec(aRect.Bottom);
       if gdPushed in aState then
         Details := ThemeServices.GetElementDetails(tbPushButtonPressed)
       else
    @@ -4258,7 +4259,7 @@
         Details := ThemeServices.GetElementDetails(tbPushButtonHot)
       else
         Details := ThemeServices.GetElementDetails(tbPushButtonNormal);
    -  ThemeSErvices.DrawElement(Canvas.Handle, Details, aRect, nil);
    +  ThemeServices.DrawElement(Canvas.Handle, Details, aRect, nil);
     end;
     
     procedure TCustomGrid.OnTitleFontChanged(Sender: TObject);
    
    grids.pas.patch (776 bytes)
  • buttonstyle.png (38,260 bytes)
    buttonstyle.png (38,260 bytes)

Activities

Michl

2014-12-27 01:05

developer  

TestDrawGrid.zip (3,448 bytes)

Michl

2014-12-27 01:06

developer  

grids.pas.patch (776 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 47221)
+++ lcl/grids.pas	(working copy)
@@ -4250,7 +4250,8 @@
 var
   details: TThemedElementDetails;
 begin
-  InflateRect(aRect, -2, 0);
+  Dec(aRect.Right);
+  Dec(aRect.Bottom);
   if gdPushed in aState then
     Details := ThemeServices.GetElementDetails(tbPushButtonPressed)
   else
@@ -4258,7 +4259,7 @@
     Details := ThemeServices.GetElementDetails(tbPushButtonHot)
   else
     Details := ThemeServices.GetElementDetails(tbPushButtonNormal);
-  ThemeSErvices.DrawElement(Canvas.Handle, Details, aRect, nil);
+  ThemeServices.DrawElement(Canvas.Handle, Details, aRect, nil);
 end;
 
 procedure TCustomGrid.OnTitleFontChanged(Sender: TObject);
grids.pas.patch (776 bytes)

Michl

2014-12-27 01:07

developer  

buttonstyle.png (38,260 bytes)
buttonstyle.png (38,260 bytes)

Juha Manninen

2017-04-25 09:50

developer   ~0099897

Ping. There is a patch.

Jesus Reyes

2017-04-30 21:26

developer   ~0100023

Thanks for the patch and the ping :)

Issue History

Date Modified Username Field Change
2014-12-27 01:05 Michl New Issue
2014-12-27 01:05 Michl File Added: TestDrawGrid.zip
2014-12-27 01:06 Michl File Added: grids.pas.patch
2014-12-27 01:07 Michl File Added: buttonstyle.png
2014-12-27 01:08 Michl Tag Attached: patch
2014-12-27 20:43 Jesus Reyes Assigned To => Jesus Reyes
2014-12-27 20:43 Jesus Reyes Status new => assigned
2017-04-25 09:50 Juha Manninen Note Added: 0099897
2017-04-30 21:26 Jesus Reyes Fixed in Revision => 54784
2017-04-30 21:26 Jesus Reyes LazTarget => 1.8
2017-04-30 21:26 Jesus Reyes Note Added: 0100023
2017-04-30 21:26 Jesus Reyes Status assigned => resolved
2017-04-30 21:26 Jesus Reyes Fixed in Version => 1.9 (SVN)
2017-04-30 21:26 Jesus Reyes Resolution open => fixed
2017-04-30 21:26 Jesus Reyes Target Version => 1.8
2017-08-21 13:20 Michl Status resolved => closed