View Issue Details

IDProjectCategoryView StatusLast Update
0017553LazarusLCLpublic2011-12-01 11:25
ReporterGraeme GeldenhuysAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSUbuntu LinuxOS Version10.04
Product Version0.9.29 (SVN)Product Build 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0017553: RowCount is lost after clearing the Header Columns
DescriptionFor some reason the RowCount is lost after you clear Header Columns. This doesn't sound right to me.

eg:
  grid.rowcount := 10;
  grid.columns.clear;
  // rowcount is not 10 anymore.
TagsNo tags attached.
Fixed in Revision28157
LazTarget0.9.30
Widgetset
Attached Files

Relationships

related to 0017538 closedJesus Reyes If StringGrid.RowCount=0 then StringGrid.ColCount=0 
related to 0017552 closedJesus Reyes StringGrid looses fixedrow count after grid is cleared 

Activities

Jesus Reyes

2010-10-26 00:35

developer   ~0042122

Last edited: 2010-10-26 00:35

For a stringgrid which is the owner of it's data, removing it's columns means the grid should lose the content, this is consistent because the grid cannot reload or refill it self once columns are added again. For a control like TDrawGrid which has not the concept of cells "holding" data but the data should reside in some other place, removing the columns and adding then again, it sounds OK if the grid remember the old rowcount (after all, the grid could assume the data is still available in some place).

Now, I don't like to have one behavior in TDrawGrid and other in TStringGrid so I agreed to restore some properties after the grid is cleared. As this report and 0017552 is related to one older 0017538 report I decided to some way link this reports and before commiting the fix ask all of your some feedback on the matter. So, if you like, please let me know what you think about it.

Graeme Geldenhuys

2010-10-26 13:33

reporter   ~0042139

To me the problems is that the StringGrid doesn't clearly differentiate between cell's and headers (columns). Currently it seems that the fixed rows (columns in this case) are simply cells like all others, just painted differently, and with a special property for access: stringgrid.columns

So when you say grid.columns.clear(), it actually seems to mean grid.clear(). This is what makes this confusing. I'm accessing the .Columns property, so would expect only columns to clear.

As I said, Columns is a property on it's own, so it should be excluded from Cells and commands that act on cells, like stringgrid.Clear.

Yes this might not be Delphi compatible (I don't really know, I don't use delphi), but as far as I know Lazarus's TStringGrid is already very different to VCL's TStringGrid, so this should be of no concern.

Jesus Reyes

2010-10-26 20:47

developer   ~0042182

"So when you say grid.columns.clear(), it actually seems to mean grid.clear(). This is what makes this confusing. I'm accessing the .Columns property, so would expect only columns to clear.

As I said, Columns is a property on it's own, so it should be excluded from Cells and commands that act on cells, like stringgrid.Clear."

But yet, people expect that grid.Columns.Add to add a physical column too (and so, cells) not just some collection of properties to control columns appearance, if Columns.Add adds a physical column, the contrary needs to be true too, ie, removing a column from Columns collection should also remove a physical column. Naturally, Columns.Clear which removes all columns from Collection should also remove all physical columns.

Issue History

Date Modified Username Field Change
2010-10-06 09:26 Graeme Geldenhuys New Issue
2010-10-25 20:54 Jesus Reyes Status new => assigned
2010-10-25 20:54 Jesus Reyes Assigned To => Jesus Reyes
2010-10-26 00:17 Jesus Reyes Relationship added related to 0017538
2010-10-26 00:18 Jesus Reyes Relationship added related to 0017552
2010-10-26 00:35 Jesus Reyes LazTarget => -
2010-10-26 00:35 Jesus Reyes Note Added: 0042122
2010-10-26 00:35 Jesus Reyes Status assigned => feedback
2010-10-26 00:35 Jesus Reyes Note Edited: 0042122
2010-10-26 13:33 Graeme Geldenhuys Note Added: 0042139
2010-10-26 20:47 Jesus Reyes Note Added: 0042182
2010-11-08 21:19 Jesus Reyes Fixed in Revision => 28157
2010-11-08 21:19 Jesus Reyes Status feedback => resolved
2010-11-08 21:19 Jesus Reyes Resolution open => fixed
2010-11-08 21:22 Jesus Reyes LazTarget - => 0.9.30
2010-11-08 21:22 Jesus Reyes Fixed in Version => 0.9.29 (SVN)
2010-11-08 21:22 Jesus Reyes Target Version => 0.9.30
2011-12-01 11:25 Marc Weustink Status resolved => closed