Page 1 of 1

Bug in Samples " Edit "

Posted: Sat May 19, 2012 1:56 pm
by steven2009
Hello larsa
I was studying the sample files. And i found that the "Edit" sample have a bug. While runing the "Edit" sample, if the sheet cell is empty, and when click it, it show an error "raised exception class EConvertError with message ''' is not a vaild floating point value." I found the error in the code was appearing in

procedure TForm1.GridSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
begin
.....
if (EditCol = Grid.Col) and (EditRow = Grid.Row) then
SetCellValue(Grid.Col - 1,Grid.Row - 1);
end;

Could you please tell me how to solve this problem. Thank you.

Re: Bug in Samples " Edit "

Posted: Mon May 28, 2012 12:12 pm
by larsa
Hello

It's not an error. The exception occures only when your app is running from delphi. Read the code more carefully. If you don't like it, you can replace StrToFloat withTryStrToFloat.

Re: Bug in Samples " Edit "

Posted: Fri Jun 01, 2012 3:04 am
by steven2009
[quote="larsa"]Hello

It's not an error. The exception occures only when your app is running from delphi. Read the code more carefully. If you don't like it, you can replace StrToFloat withTryStrToFloat.[/quote]

Thank you larsa, i have solved this problem, but not in your methods. I used directly judgement "if ... else ..." in procedure SetCellValue, and drop the "try... except...". I think the problem cames from the indefinite cell keypress formation, because if edittext is all numbers it would be OK, but letter would be error. So i use directly judgement and solve the problem completely.