Re: Selection handling in own widget




G'Day !

 I cannot help with your problem, but I thought I would let you know you might be infected with the "Love you" virus.  I had some sort of icon on the bottom of my mail labeled as follows

"Love-Letter-for-you.txt.vbs"

Luckily we don't use M$ mail products ....

cheers,
Jim Parker

Sailboat racing is not a matter of life and death ....  It is far more important than that !!!



Gert <gs2 node17530 a2000 nl>
Sent by: gtk-app-devel-list-admin gnome org

01/24/01 01:40 AM

       
        To:        gtk-app-devel-list gnome org
        cc:        
        Subject:        Selection handling in own widget


Hi,

I have written a text output widget for my program, and naturally I want
the user to be able to select text and paste it in another application,
so I added the following lines to my code:

In the _init function:
 gtk_selection_add_target(GTK_WIDGET (gmo), GDK_SELECTION_PRIMARY,
                                                     GDK_SELECTION_TYPE_STRING, 1);
Added function references in the _class_init:
 widget_class->selection_clear_event   = gtk_gmo_selection_clear_event;
 widget_class->selection_get           = gtk_gmo_selection_get;

If the user has selected text I use the:
 ok = gtk_selection_owner_set(GTK_WIDGET(gmo),
                                                         GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
to claim the selection, and if the user then clicks (for example) with the
middle mouse button in an xterm, the gtk_gmo_selection_get function is called,
I fill in the data and everything works.

Well, not very time, and there's the problem. Somtimes, and I can't figure
out when, my _get function doesn't get called...
Another symptom is, that I seem to `loose' the selection, as in that the
gtk_selection_owner_set returns true, but when the user selects the next
letter, gdk_selection_owner_get doesn't match with my GdkWindow...

I tried filling in the other selection related fields, but the only thing I
noticed is that I got an selection_request_event insead of the
selection_get signal, but I don't understand why/what/etc ...
   
I really hope anyone can help, cause I don't get it anymore :(

 Gert

--

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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