Custom container as drag dest



Hi,

I'm having trouble getting my head around drag-and-drop.

At a simplified level, I have a canvas (implemented as a custom
container with its own GdkWindow) with some icons on it, and I'd like
the user to be able to drag-and-drop the icons into new locations
within the container canvas. I am able to move widgets at the code
level, I'm just stuck on connecting this up with the drag-and-drop
infrastructure.

Here is a PyGTK test app which illustrates my difficulty:
http://dev.laptop.org/~dsd/20111003/ddtest.py

It draws a square-with-line icon towards the top left and sets it as a
drag source. The parent container and its parent GtkWindow are both
set as drag destinations, and I hook up all of the drag-related
signals on the icon widget, container, and the window, just so that I
can see whats going on.

The result is that the drag-related signals are received only by the
parent GtkWindow and not by the container (apart from drag-begin which
is received by the source). I would like them to be received by the
container. Not marking the GtkWindow as a drag dest doesn't help.

If I swap out my custom container for a GtkFixed, then both the
GtkFixed and the parent GtkWindow receive the signals I'm interested
in.

What am I doing wrong in my custom container class for it to not
receive drag events or act as a drag dest?

cheers
Daniel


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