View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003386 | JEDI VCL | 00 JVCL Components | public | 2005-12-26 09:34 | 2006-02-06 07:38 |
Reporter | Lutz | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | 3.20 | |||
Summary | 0003386: TJvStringGrid.LoadFromFile is loading only the first Row | ||||
Description | Unit: JvStringGrid TJvStringGrid.LoadFromFile is loading only the first Row. Solution: Row 770 to 813 procedure TJvStringGrid.LoadFromStream(Stream: TStream); Replace var "Rom" by "Row", recompile the unit. | ||||
Tags | No tags attached. | ||||
|
Can you attach the zipped sources of a sample application showing the problem? I don't understand why changing a variable name would fix the issue. |
|
Sure,you are right, the name of a variable doesn't matter much. But please watch the following code. IMHO is it simply more logical to use everywhere "Row" instead of "Rom". But feel free to use "Rom", but if you do it, be consequent to use it everywhere. The RowCount will not be increased if you use inconsequently and only here the name "Row". This is the orignal code snippet from TJvStringGrid.pas with my explanation of the mistake: ================================================================ procedure TJvStringGrid.LoadFromStream(Stream: TStream); var Col, Rom, I, Count: Integer; Buffer: array [0..BufSize - 1] of Byte; St: string; begin Col := 0; Rom := 1; DoLoadProgress(0, Stream.Size); while Stream.Position < Stream.Size do begin Count := Stream.Read(Buffer, 1024); DoLoadProgress(Stream.Position, Stream.Size); for I := 0 to Count - 1 do case Buffer[I] of 0: begin Inc(Col); if Rom > RowCount then RowCount := Rom; if Col > ColCount then ColCount := Col; Cells[Col - 1, Rom - 1] := St; St := ''; end; 1: begin Inc(Col); if Col > ColCount then ColCount := Col; Cells[Col - 1, Rom - 1] := St; Inc(Rom); if Rom > RowCount then { ==!!==> } RowCount := Row; { <== This is the inconsequence! } Col := 0; St := ''; end; else St := St + Char(Buffer[I]); end; end; RowCount := RowCount - 1; DoLoadProgress(Stream.Size, Stream.Size); end; ================================================================ Sorry if I did not attach an example but my application is simply to big for this small mistake. I am sure you can follow my idea without an example. Impact: The mistake was not the use of another name for the variable but the inconsequently use of it. My beauty-feeling for self-explaining code still says: use the name "Row". |
|
Thanks, I did not notice. This is now fixed in CVS |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-12-26 09:34 | Lutz | New Issue | |
2006-01-08 12:08 | obones | Note Added: 0008346 | |
2006-01-08 12:08 | obones | Status | new => feedback |
2006-01-08 17:27 | Lutz | Note Added: 0008354 | |
2006-01-08 17:29 | Lutz | Note Edited: 0008354 | |
2006-01-08 17:29 | Lutz | Note Edited: 0008354 | |
2006-02-06 07:38 | obones | Status | feedback => resolved |
2006-02-06 07:38 | obones | Resolution | open => fixed |
2006-02-06 07:38 | obones | Assigned To | => obones |
2006-02-06 07:38 | obones | Note Added: 0008511 |