Re: GTK TreeView control in Windows (DND issue)



Thanks for the prompt help with this, guys.  I took a look at David's suggestion....

On 15 Sep 2011, at 14:32, David Nečas wrote:

> 
> So IMO you need to go one level up and look at what ‘widget’ is and why
> it does not have any "gtk-drag-dest" data.  AFAIK the data can be
> attached by gtk_drag_dest_set() or gtk_drag_dest_set_proxy() and in case
> of a treeview this should happen, quite straightforwardly, if you call
> gtk_tree_view_enable_model_drag_dest().
> 
> So either "gtk-drag-dest" data fails to be set, gets unset somehow
> (cannot see how) or the code above looks for it in the wrong widget.
> 

What I found was that the "gtk-drag-dest" data was being correctly set for the drop target.  You can check this by doing the following:-

1)  Find (your_gtk_source_modules)/gtk/gtkdnd.c
2)  Find the function called 'gtk_drag_dest_set_internal()'
3)  After the call to 'g_return_if_fail()' place this line:-

      printf ("Widget originally set as drag_dest target was 0x%p\n", widget);

This prints out an address for the widget being set as the drop target.  This is (correctly AFAICT) the address of a TreeView control.  Now, to check which widget is actually being tested:-

1)  Find (your_glib_source_modules)/gobject/gobject.c
2)  Find the function 'g_object_get_data()'
3)  After the calls to 'g_return_val_if_fail()' place these 2 lines:-

      if (0 == strcmp (key, "gtk-drag-dest"))
            printf ("Widget being tested is 0x%p\n", object);

Test this with a DnD scenario that works (I can supply some sample code if needed) but what happens is that whenever you drag a drag_source over any window you'll see 'g_object_get_data()' getting called for each window.  When you eventually drag it over the drop target you'll see the drop target's address (as originally set during 'gtk_drag_dest_set_internal()').

Now build the toolkit's own treeview sample.  If you click and drag a treeview row, notice that you keep getting the same address getting printed - but this ISN'T the address that was originally set up as the drag target.

So that's what's wrong.  I don't yet know which widget the address actually refers to and don't have any more time to look into this today but I'll resume again in a few days if no-one's come up with a possible explanation by then.  Regards.

John


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