[Mono-winforms-list] how to use the clipboard?

Martin Matusiak numerodix at gmail.com
Wed Mar 25 09:32:06 EDT 2009


So I found that on linux the standard clipboard behavior isn't there.
I select text with the mouse, it's not on the clipboard. So I tried
this:

RichTextBox txt = new RichTextBox();
txt.SelectionChanged += delegate (object o, EventArgs a) {
	if (txt.SelectedText != String.Empty) {
		Clipboard.SetDataObject(txt.SelectedText);
		Console.WriteLine(Clipboard.GetText());
	}
};

Now it appears in the console just fine. But klipper doesn't see it,
and it's not pasteable either using middle button or ctrl+v.

It does work in .NET, but there the text comes with boxes where the
newlines are (despite being displayed correctly in the gui). :(


Martin


More information about the Mono-winforms-list mailing list