View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0021496 | Lazarus | LCL | public | 2012-03-17 09:22 | 2012-03-21 09:24 |
Reporter | Assigned To | Jesus Reyes | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | x64 | OS | Windows | ||
Product Version | 0.9.31 (SVN) | ||||
Fixed in Version | 0.9.31 (SVN) | ||||
Summary | 0021496: [PATCH] Draw dbgrid header columns/rows when DefaultDrawing false | ||||
Description | When using DefaultDrawing false and running my own OnDrawColumnCell, fixed/header columns and rows are not drawn (see Windows screenshot). The patch fixes this issue - tested on Windows and Linux x64. Based on Ludo Brands' code in the forums: http://lazarus.freepascal.org/index.php/topic,16300.msg88285.html#msg88285 Thanks. | ||||
Steps To Reproduce | Run sample program, import messages.csv. Grid header columns and rows will bleed through and no header text is drawn (see Windows screenshot). Tested on Windows; on x64 Linux Lazarus r 35878, the bleed through does not happen, but the texts are not drawn in the header rows. Probable low risk for other widgetsets as the patch only calls already existing DefaultDrawCell... | ||||
Additional Information | I've assigned it to the LCL category instead of database as it seems to be a pure drawing bug, not a database-specific item. Don't know if this issue also happens on other grids. Also, dbgrids.pas is in the lcl directory :) It seems the OnDefaultDrawing event does not fire on header rows/columns. Delphi XE2 DefaultDrawColumnCell documentation would imply that OnDrawColumnCell is fired for all cells, including header cells. However, looking at the LCL code - it uses DataCol, it seems it is only intended for data cells (non-header cells). Perhaps the XE2 documentation is wrong - or I interpreted it incorrectly ;) | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 36180 | ||||
LazTarget | 0.99.0 | ||||
Widgetset | GTK 2, Win32/Win64 | ||||
Attached Files |
|
2012-03-17 09:22
|
DBGridCustomDrawHeader.diff (826 bytes)
Index: lcl/dbgrids.pas =================================================================== --- lcl/dbgrids.pas (revision 36074) +++ lcl/dbgrids.pas (working copy) @@ -2750,11 +2750,15 @@ if (ARow>=FixedRows) and Assigned(OnDrawColumnCell) and not (csDesigning in ComponentState) then begin - DataCol := ColumnIndexFromGridColumn(aCol); if DataCol>=0 then - OnDrawColumnCell(Self, aRect, DataCol, TColumn(Columns[DataCol]), aState); - + OnDrawColumnCell(Self, aRect, DataCol, TColumn(Columns[DataCol]), aState) + else //Fixed row? + DefaultDrawCell(aCol, aRow, aRect, aState); + end + else begin //Designing, or fixed column + if not DefaultDrawing then // don't draw twice + DefaultDrawCell(aCol, aRow, aRect, aState); end; DrawCellGrid(aCol, aRow, aRect, aState); |
2012-03-17 09:22
|
|
2012-03-17 09:22
|
|
|
Thanks for the patch, I have not applied as is because it draws twice fixed columns which made indicator cell appear black. Indeed, it seems delphi dbgrid do not allow to do custom fixed cells drawing. Please tests |
|
Thanks, Jesus, works perfectly on Win32 on today's SVN. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-03-17 09:22 |
|
New Issue | |
2012-03-17 09:22 |
|
File Added: DBGridCustomDrawHeader.diff | |
2012-03-17 09:22 |
|
Widgetset | => GTK 2, Win32/Win64 |
2012-03-17 09:22 |
|
File Added: dbgridbug.zip | |
2012-03-17 09:22 |
|
File Added: gridheaders.png | |
2012-03-17 09:32 | Jesus Reyes | Status | new => assigned |
2012-03-17 09:32 | Jesus Reyes | Assigned To | => Jesus Reyes |
2012-03-20 20:01 | Jesus Reyes | Fixed in Revision | => 36180 |
2012-03-20 20:01 | Jesus Reyes | LazTarget | => 0.99.0 |
2012-03-20 20:01 | Jesus Reyes | Status | assigned => resolved |
2012-03-20 20:01 | Jesus Reyes | Fixed in Version | => 0.9.31 (SVN) |
2012-03-20 20:01 | Jesus Reyes | Resolution | open => fixed |
2012-03-20 20:01 | Jesus Reyes | Note Added: 0057857 | |
2012-03-20 20:01 | Jesus Reyes | Target Version | => 0.99.0 |
2012-03-21 09:24 |
|
Status | resolved => closed |
2012-03-21 09:24 |
|
Note Added: 0057868 |