[Lazarus] Selection issues in class derived from TCustomDrawGrid

Werner Pamler werner.pamler at freenet.de
Sun Sep 14 17:17:38 CEST 2014

 >>> Is this in the latest svn-version (3561)?
Yes, but I've seen it for a couple of months since I added selections to 
the worksheet grid.

 >>> Could you provide sample code? (or is it also just as simple as mine?)
Yes, just like what you say. Or just run "spready" which starts with an 
empty spreadsheet, activate editing (by clicking at the pen icon in the 
toolbar), click at any cell, hold shift down and click at any other 
cell. You should see the selected cells with modified background color 
and enclosed by a thick selection rectangle. It does not work for me. If 
you disable editing (by clicking on the pen icon another time) and 
repeat the same, everything works as expected.

 >>> some other weird stuff (like reading an .ods gives me an error 
about adding a empty name for a worksheet and when changing a cell in 
the grid i get an invalid date format error
To keep things apart could you write a bug report? Add a short demo and 
give step-by-step instructions for me to follow what you are doing. I 
don't understand this short desciption here because you are saying that 
you change a cell in the "grid", but you also say that you never used 
the gui-components - the grid is one...

Just these two comments:
- Invalid sheet names have been addressed in a recent commit (a few days 
ago). Sheet names must follow the rules set up for Excel (which seem to 
be valid for ods as well).
- A date format error does happen with TsWorksheetGrid after entering 
data because here strings are entered in the first place. The grid tries 
to determine from the string which type of cell has to be used in the 
worksheet. Unfortunately, the TryStrToDateTime() function does raise an 
exception - this is different from TryStrToFloat for ordinary numbers 
(and also different from Delphi)... I plan to take the time to rearrange 
the code in StrToDateTime and TryStrToDateTime such that the latter one 
just returns true or false, without an exception. Anyway, this error 
does not occur when the program runs outside of Lazarus.

More information about the Lazarus mailing list