View Issue Details

IDProjectCategoryView StatusLast Update
0034017LazarusLCLpublic2018-08-15 10:09
ReporterMartin FriebeAssigned ToJesus Reyes 
Status resolvedResolutionfixed 
Platform64bit IntelOSwin 10OS Version10
Product Version1.9 (SVN)Product Build 
Target Version1.10Fixed in Version1.9 (SVN) 
Summary0034017: TCustomGrid: incorrect ClipRect handling with goColSpanning
DescriptionWith goColSpanning the extend of a cell can cover additional cells.

In TCustomGrid.DrawRow is the following code:
    for aCol:=left to Right do begin
      ColRowToOffset(True, True, aCol, R.Left, R.Right);
      if (R.Left>=R.Right) or not HorizontalIntersect(R, ClipArea) then

This code runs before R (the cell rectangle) is extended (which happens in TCustomDrawGrid.DefaultDrawCell).

So if the cliprect only covers the cell to the right, then the current cell will not be drawn, even if it will/would extend to the cell on the right.

In most cases the entire grid is painted, and the issue does not manifest. But if only part of the grid needs to be repainted, then this can happen.

Further more the nested proc DoDrawCell calls InterSectClipRect(Canvas.Handle, R.Left, R.Top, R.Right, R.Bottom);

So even if DefaultDrawCell is called, it can not paint the extended rect of the cell.
TagsNo tags attached.
Fixed in Revision58708
Attached Files


Martin Friebe

2018-07-21 19:50

manager   ~0109607

The effect can be observed in the editor options: User defined markup. (after the fix of 0028253)

Jesus Reyes

2018-08-14 21:15

developer   ~0110045

Solved the issue partially, there is still a problem, when hovering the column button of the extended cell it will be still treated as individual cell and will be painted bad, this is because there is no way to inform the grid that this cell area is part of an extended cell, could be further fixed by checking all previous cells finding if this area belongs to other cell, I don't know if it worths the effort because IMO this can only be solved efficiently by implementing real merged cells, if that is implemented then goColSpanning will be removed. Indeed goColSpanning makes no sense in a normal grid and IMO is should not be used to control derived grids built-in functionality.


2018-08-14 21:22

developer   ~0110046

Dou you know the merged cells example which I uploaded to examples/gridexamples some time ago?

Jesus Reyes

2018-08-15 04:49

developer   ~0110050

Last edited: 2018-08-15 10:09

View 2 revisions

Ups I broke it. Checked other grids but I forgot to check the merged cells example. I will try to fix it or I will revert the change.

Edit: Done in r58711 also improved keyboard navigation of merged cells.

Issue History

Date Modified Username Field Change
2018-07-21 18:04 Martin Friebe New Issue
2018-07-21 18:07 Martin Friebe Description Updated View Revisions
2018-07-21 19:50 Martin Friebe Note Added: 0109607
2018-08-14 18:50 Jesus Reyes Assigned To => Jesus Reyes
2018-08-14 18:50 Jesus Reyes Status new => assigned
2018-08-14 21:15 Jesus Reyes Fixed in Revision => 58708
2018-08-14 21:15 Jesus Reyes LazTarget - => 1.10
2018-08-14 21:15 Jesus Reyes Note Added: 0110045
2018-08-14 21:15 Jesus Reyes Status assigned => resolved
2018-08-14 21:15 Jesus Reyes Fixed in Version => 1.9 (SVN)
2018-08-14 21:15 Jesus Reyes Resolution open => fixed
2018-08-14 21:15 Jesus Reyes Target Version => 1.10
2018-08-14 21:22 wp Note Added: 0110046
2018-08-15 04:49 Jesus Reyes Note Added: 0110050
2018-08-15 10:09 Jesus Reyes Note Edited: 0110050 View Revisions