[Lazarus] Clipboard Data Goes Away
Anthony Walter
sysrpl at gmail.com
Thu Apr 1 10:35:05 CEST 2021
Here is a follow-up.
I wrote a simple test using LCL Gtk2 and gtk_clipboard_store. This test
allows the clipboard data to persist after my program exited. Button1 click
sets the clipboard data. If Button2 clicked the data will persist after the
program exits. If Button2 is not clicked, the data does not persist.
Curiously, as the LCL Gtk2 currently stands, gtk_clipboard_store() does not
work. I suspect the LCL is not using the same GdkAtom clipboard as returned
by gtk_clipboard_get(GDK_SELECTION_CLIPBOARD).
uses
Gtk2, Gdk2;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
S: string;
begin
S := Edit1.Text;
gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
PChar(S), Length(S))
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
gtk_clipboard_store(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end;
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210401/f2ed69af/attachment.html>
More information about the lazarus
mailing list