1. EuGTK - clipboard?

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.

new topic     » topic index » view message » categorize

2. Re: EuGTK - clipboard?

Jerry_Story said...

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/

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuGTK - clipboard?

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.

new topic     » goto parent     » topic index » view message » categorize

4. Re: EuGTK - clipboard?

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.

new topic     » goto parent     » topic index » view message » categorize

5. Re: EuGTK - clipboard?

irv said...

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:

gnome.org said...

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.

new topic     » goto parent     » topic index » view message » categorize

6. Re: EuGTK - clipboard?

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

new topic     » goto parent     » topic index » view message » categorize

7. Re: EuGTK - clipboard?

irv said...
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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu