1. EuGTK - clipboard?
- Posted by Jerry_Story Sep 13, 2010
- 1551 views
How can I do something like this in EuGTK?
st = "a bunch of stuff to go to the clipboard" set_clip_text(st) -- to the clipboard
A search for "clip" on testdescriptions.txt finds nothing. In GtkRoutines.e there are some "clipboard" things in control[GtkTextBuffer] but I don't know how to use that.
2. Re: EuGTK - clipboard?
- Posted by jimcbrown (admin) Sep 13, 2010
- 1571 views
How can I do something like this in EuGTK?
st = "a bunch of stuff to go to the clipboard" set_clip_text(st) -- to the clipboard
A search for "clip" on testdescriptions.txt finds nothing. In GtkRoutines.e there are some "clipboard" things in control[GtkTextBuffer] but I don't know how to use that.
The GTK clipboard functions (such as the one you want, gtk_clipboard_set_text() ) are documented here: http://library.gnome.org/devel/gtk/stable/gtk-Clipboards.html
Some examples in Python and C: http://www.deskchecked.com/2007/06/27/passing-data-between-gtk-applications-with-gtkclipboard/
3. Re: EuGTK - clipboard?
- Posted by irv Sep 13, 2010
- 1487 views
Since the GtkClipboard does not have a constructor (IOW, there's no 'new' method for clipboard) this will take some code changes in several spots.
You might want to wait until tomorrow to see if I can add a fake constructor.
Until then, it's going to be difficult to get it to work.
4. Re: EuGTK - clipboard?
- Posted by irv Sep 14, 2010
- 1447 views
Hmmm... before I do a lot of work on this, please study the following: http://library.gnome.org/devel/gtk/unstable/gtk3-Clipboards.html then tell me if it is really what you want to do.
This Gtk Clipboard seems to have nothing at all to do with the OS/WM clipboard, but is instead a method of passing data between Gtk processes (IPC). I may be wrong, the documentation is dense at best.
5. Re: EuGTK - clipboard?
- Posted by jimcbrown (admin) Sep 14, 2010
- 1417 views
Hmmm... before I do a lot of work on this, please study the following: http://library.gnome.org/devel/gtk/unstable/gtk3-Clipboards.html then tell me if it is really what you want to do.
This Gtk Clipboard seems to have nothing at all to do with the OS/WM clipboard, but is instead a method of passing data between Gtk processes (IPC). I may be wrong, the documentation is dense at best.
From the link you provided:
The GtkClipboard object represents a clipboard of data shared between different processes or between different widgets in the same process. Each clipboard is identified by a name encoded as a GdkAtom. (Conversion to and from strings can be done with gdk_atom_intern() and gdk_atom_name().) The default clipboard corresponds to the "CLIPBOARD" atom; another commonly used clipboard is the "PRIMARY" clipboard, which, in X, traditionally contains the currently selected text.
This is confusing, but my understanding was that the X PRIMARY clipboard was effectively what the middle button in X (pasting text) used.
6. Re: EuGTK - clipboard?
- Posted by irv Sep 14, 2010
- 1383 views
It appears you are correct:
include GtkEngine.e constant win = create(GtkWindow) connect(win,"destroy",quit) set(win,"default size",400,300) constant panel = create(GtkVBox) add(win,panel) constant cb = create(GtkClipboard) set(cb,"text",sprintf("2 x 2 = %d",2*2)) show_all(win) main()
When run, you can paste (in your word processor, for example) and get:
2 x 2 = 4
So, give me a few minutes, and I'll post a new version of the EuGTK library on my website which has the clipboard implemented.
http://etcwebspace.com/users/irvm/EuGTK_4.1.9.tar.gz
OK, the update is there now
7. Re: EuGTK - clipboard?
- Posted by Jerry_Story Sep 15, 2010
- 1352 views
constant cb = create(GtkClipboard) set(cb,"text",sprintf("2 x 2 = %d",2*2))
When run, you can paste (in your word processor, for example) and get:
2 x 2 = 4
Yup. That's what I wanted.