Re: Selecting text in a GtkTreeView widget



As you can see from my many questions I know very little and certainly
not the answer to this question.. but let me throw an idea your way
anyway :)

I assume if there is text in the widget, that it must be possible to
obtain the text via a function call.. and if not, you could always
set_data the widget with the text as well and then use get_data to get
it back again (or whatever the exact set and get data functions are).

Then you could attach a signal to the GtkTreeView cell that checks for
the widget text being highlighted.. I assume you can anyway.
Or if not you can at least check to see if the mouse has been pressed
down on it, if the mouse has been dragged over it, and if the mouse has
been released on it.. and you could use those to simulate checking for
highlight. The callback function could then get_data or otherwise get
the text, and manually feed it into the copy/paste buffer - again, not
sure how to do this.. but am assuming there is a way.

Perhaps this isn't exactly what you asked for.. but if no-one else can
give you a suitable answer, it might be worth thinking about this sort
of thing.

On Thu, 2002-12-12 at 09:25, Drew Parsons wrote:
On Wed, Dec 11, 2002 at 10:45:04AM -0500, Alban Deniz wrote:
Hello,

I tried to post this on 07 Dec, but I don't think it made it to the list. I
received no replies from the previous posting, and I couldn't find it in the
mailing list archives. My apologies if you've already seen this:


I saw your message but didn't reply, because I'm interested in hearing the
answer too :)

I would like to be able to select some text in a GtkTreeView cell
(G_TYPE_STRING) with the left mouse button, and past it into another
application (such as emacs) with the middle mouse button.

As far as I can tell this is a general problem with GTK.  It does not
support copy&paste from any arbitrary text displayed.  You can copy editable
text, but not plain displayed text.  I find it rather irritating too.  
Qt lets you copy any text.  Why doesn't GTK?

It's not just with GtkTreeView, it's with all text-displaying widgets.  I
believe there's something particular you have to do to allow the text to be
copyable.  For instance, GtkLabel has gtk_label_set_selectable().  But I'm
not aware of any general solution to make all text generally "selectable" by
default.

In my opinion, the current situation is a bug.  Being able to copy text is too
useful a function for it (the inability to copy) to be considered a
"desirable feature".  But I guess the GTK designers had their reasons for
banning it.

Drew
-- 
                Azrael

           ("\''/").___..--'''"-._          
           `0_ O  )   `-.  (     ).`-.__.`) 
           (_Y_.)'  ._   )  `._ `. ``-..-'  
         _..`--'_..-_/  /--'_.' .'          
        ((i).-''  ((i).'  (((.-'         
   
Of all God's creatures there is only one that cannot be made the slave
of the lash. That one is the cat. If man could be crossed with a cat it
would improve man, but it would deteriorate the cat. 

ICQ#52944566




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]