Re: drag and drop between a GtkTreeView and a GtkLabel



phytOS wrote:

Hi everybody,
I want to drag and drop a element of my GtkTreeView on a label to have
the text diplayed in the selected element on my label. I read some Gtk
tutorial and the API on gtk.org but my program do not work.
I can see the drag_data_get and drag_end signals but not the
drag_data_received...

Ignore my previous guess. I got my GtkTreeView -> GtkTextView drag/drop working.

Check the GtkTargetEntry parameter you pass to the gtk_drag_set_source and gtk_drag_set_dest functions. If they don't match, it wont work.

I found that to drag from a GtkTreeView to a GtkTextView I had to set the target to:
static const GtkTargetEntry targetEntries[] = {
{ "STRING", 0, 0 }
};

on the Tree View. In the Gtk 1.2 version of my app I had it set to "text/plain" but this now didn't work. I didn't have to set the Text View up at all because it was set by default.

And I used this on the Tree View:
gtk_drag_source_set(GTK_WIDGET(view), GDK_BUTTON1_MASK, targetEntries, TARGET_COUNT, GDK_ACTION_COPY);

Once I did that I could drag from the Tree View to text boxes in the same app or other apps.





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