1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
procedure TCdrBRIC4Device.btnCopyClick(Sender: TObject);
var
LS: TStringList;
s: Integer;
MyClipBoard: TClipboard;
EWE: String;
begin
AfficherMessage('');
LS := TStringList.Create;
// remplissage de la liste
//*****
//*****
MyClipBoard := TClipboard.Create(ctClipBoard);
try
try
// Mettre le contenu de la liste dans le presse-papiers
if (LS.Count = 0) then exit;
MyClipBoard.Clear;
EWE := format(' LS contient %d lignes', [LS.Count]); // Initialisation de l'en-tête à ma manière (je suis athéiste militant ...)
for s := 0 to LS.Count - 1 do
begin
AfficherMessage(LS.Strings[S]); // affichage du contenu, c'est OK
EWE += LS.Strings[s] + System.LineEnding;
end;
MyClipBoard.AsText := EWE;
except
on E: Exception do AfficherMessage(E.Message);
end;
finally
LS.Free;
FreeAndNil(MyClipBoard);
end;
end; |
Partager