[Gtk-sharp-list] Clipboard

Daniel Kornhauser dkor@media.mit.edu
Mon, 15 Dec 2003 22:15:28 -0500


If you are talking about a TextBuffer Widget, you have to instance your
clipboard

static Clipboard  clipboard;
clipboard = Gtk.Clipboard.Get (Atom.Intern("CLIPBOARD", false));

and in the following code buffer stands for a TextBuffer instance.

		public void  OnPaste (object o, EventArgs args) 
                {
			buffer.PasteClipboard (clipboard);
		}


		public void  OnCopy (object o, EventArgs args) 
                {
			buffer.CopyClipboard (clipboard);
		}

		public void  OnCut(object o, EventArgs args) 
                {
			buffer.CutClipboard (clipboard, true);
		}

Note : This only works with text, I don't think it works with anchors
(images, and other widgets).

			Have fun.

					Daniel.

On Mon, 2003-12-15 at 19:05, Met @ Uber wrote:
> How do I put something into the clipboard (copy) in Gtk# so that another
> program can make use of it (paste) ?
> 
> ~ Matthew
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list