Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

stringgrid copytoclipboard

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

Lazarus 0.9.29 r25476 FPC 2.4.0 i386-win32-win32/win64

If I put a TStringGrid on a form and then in Form Click event I put:?

procedure TForm1.FormClick(Sender: TObject);
begin
   StringGrid1.CopyToClipboard(False);
end;

I properly get the stringgrid in the clipboard if the stringgrid is filled as follows:

procedure TForm1.FormCreate(Sender: TObject);
begin
   StringGrid1.cells[0, 1]:= '1';
   StringGrid1.cells[0, 2]:= '2';
   StringGrid1.ColCount:= 3;
   StringGrid1.cells[1, 0]:= 'a';
   StringGrid1.cells[1, 1]:= '1';
   StringGrid1.cells[2, 1]:= '2';
   StringGrid1.cells[2, 0]:= 'b';
end;

Otherwise if I use the following code the grid is filled identically but when I copy it to the clipboard the titles are missing.

procedure TForm1.FormCreate(Sender: TObject);
begin
   StringGrid1.cells[0, 1]:= '1';
   StringGrid1.cells[0, 2]:= '2';
   StringGrid1.Columns.Add;
   StringGrid1.Columns[0].Title.Caption:= 'a';
   StringGrid1.Cells[1, 1]:= '1';
   StringGrid1.Columns.Add;
   StringGrid1.Columns[1].Title.Caption:= 'b';
   StringGrid1.Cells[2, 1]:= '2';
end;

regards,
andrea

Reply by email

Jesus Reyes
to Andrea Mauri

--- El lun 17-may-10, Andrea Mauri escribi?:

Show quoted text 54 lines
De: Andrea Mauri Asunto: [Lazarus] stringgrid copytoclipboard A: "Lazarus mailing list" Fecha: lunes, 17 de mayo de 2010, 9:15 Lazarus 0.9.29 r25476 FPC 2.4.0 i386-win32-win32/win64 If I put a TStringGrid on a form and then in Form Click event I put:? procedure TForm1.FormClick(Sender: TObject); begin ? StringGrid1.CopyToClipboard(False); end; I properly get the stringgrid in the clipboard if the stringgrid is filled as follows: procedure TForm1.FormCreate(Sender: TObject); begin ? StringGrid1.cells[0, 1]:= '1'; ? StringGrid1.cells[0, 2]:= '2'; ? StringGrid1.ColCount:= 3; ? StringGrid1.cells[1, 0]:= 'a'; ? StringGrid1.cells[1, 1]:= '1'; ? StringGrid1.cells[2, 1]:= '2'; ? StringGrid1.cells[2, 0]:= 'b'; end; Otherwise if I use the following code the grid is filled identically but when I copy it to the clipboard the titles are missing. procedure TForm1.FormCreate(Sender: TObject); begin ? StringGrid1.cells[0, 1]:= '1'; ? StringGrid1.cells[0, 2]:= '2'; ? StringGrid1.Columns.Add; ? StringGrid1.Columns[0].Title.Caption:= 'a'; ? StringGrid1.Cells[1, 1]:= '1'; ? StringGrid1.Columns.Add; ? StringGrid1.Columns[1].Title.Caption:= 'b'; ? StringGrid1.Cells[2, 1]:= '2'; end; regards, andrea --

This is a bug, please submit a bug report.

Jesus Reyes A.

Reply by email