View Issue Details

IDProjectCategoryView StatusLast Update
0018213LazarusPatchpublic2011-09-25 19:04
ReporterTomasz WieckowskiAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0018213: TStringGrid - paste data
DescriptionWhen you paste data into the Grid cells there is a "Index out of range" exception, this happens when you try to paste more data then can be fit.
And shouldn't paste into readonly columns.

I attach the proposed patch.
TagsNo tags attached.
Fixed in Revision32504
LazTarget0.99.0
WidgetsetGTK 2, Win32/Win64
Attached Files
  • grid_paste.patch (596 bytes)
    Index: lcl/grids.pas
    ===================================================================
    --- lcl/grids.pas	(revision 28707)
    +++ lcl/grids.pas	(working copy)
    @@ -9630,9 +9630,12 @@
       try
         L.Text := TheText;
         for j:=0 to L.Count-1 do begin
    +      if j+StartRow >= RowCount then
    +        break;
           CollectCols(L[j]);
           for i:=0 to SubL.Count-1 do
    -        Cells[i + StartCol, j + StartRow] := SubL[i];
    +        if (i+StartCol<ColCount) and (not GetColumnReadonly(i+StartCol)) then
    +           Cells[i + StartCol, j + StartRow] := SubL[i];
         end;
       finally
         SubL.Free;
    
    grid_paste.patch (596 bytes)

Activities

2010-12-13 22:23

 

grid_paste.patch (596 bytes)
Index: lcl/grids.pas
===================================================================
--- lcl/grids.pas	(revision 28707)
+++ lcl/grids.pas	(working copy)
@@ -9630,9 +9630,12 @@
   try
     L.Text := TheText;
     for j:=0 to L.Count-1 do begin
+      if j+StartRow >= RowCount then
+        break;
       CollectCols(L[j]);
       for i:=0 to SubL.Count-1 do
-        Cells[i + StartCol, j + StartRow] := SubL[i];
+        if (i+StartCol<ColCount) and (not GetColumnReadonly(i+StartCol)) then
+           Cells[i + StartCol, j + StartRow] := SubL[i];
     end;
   finally
     SubL.Free;
grid_paste.patch (596 bytes)

Jesus Reyes

2011-09-24 20:23

developer   ~0052151

Applied, thanks for patch and remainder

Issue History

Date Modified Username Field Change
2010-12-13 22:23 Tomasz Wieckowski New Issue
2010-12-13 22:23 Tomasz Wieckowski File Added: grid_paste.patch
2010-12-13 22:23 Tomasz Wieckowski Widgetset => GTK 2, Win32/Win64
2010-12-13 23:17 Vincent Snijders LazTarget => 0.99.0
2010-12-13 23:17 Vincent Snijders Status new => assigned
2010-12-13 23:17 Vincent Snijders Target Version => 0.99.0
2010-12-16 10:52 Vincent Snijders Assigned To => Jesus Reyes
2011-09-24 20:23 Jesus Reyes Fixed in Revision => 32504
2011-09-24 20:23 Jesus Reyes Status assigned => resolved
2011-09-24 20:23 Jesus Reyes Fixed in Version => 0.9.31 (SVN)
2011-09-24 20:23 Jesus Reyes Resolution open => fixed
2011-09-24 20:23 Jesus Reyes Note Added: 0052151
2011-09-25 19:04 Tomasz Wieckowski Status resolved => closed