A friend of mine reports from looking at the GTK sources that
drag-and-drop signals are explicitly excluded from propagating like
other signals.

matt

On Thu, Dec 09, 2004 at 05:58:01PM -0800, Matt Chisholm wrote:
>Do drag-and-drop signals not propagate to parent widgets like other
>signals?
>
>Nested widgets can attach signal handlers to a signal, and then return
>gtk.FALSE if they want the signal to be propagated to their
>ancestors But returning gtk.FALSE from a signal handler attached to a
>drag-and-drop signal (specifically, 'drag_motion') does not seem to
>propagate the signal to parent widgets.
>
>Is there some way to force DND signals to propagate to parent widgets?
>
>Perhaps I am really stupid and just missing something important. 
>
>I'm including some sample code with a series of nested widgets that
>demonstrates this. Clicking anywhere propagates the click signal to
>all parent widgets. But dragging "middle" over anything only raises
>the signal on the current widget. 
>
>matt
>
>ps. I assume that there is no built-in way to have a scrolled window
>containing drag targets automatically scroll as you drag a drag-source
>over it...

>import gtk
>TARGET_TYPE = 1
>
>def event(widget, event, i, *args):
>    if event.type == gtk.gdk.BUTTON_RELEASE:
>        print 'click event on frame #', i
>    return gtk.FALSE
>
>def drag_motion(widget, context, x, y, time, i):
>    print 'drag motion on frame #', i
>    return gtk.FALSE
>    
>last = None
>for i in range(0,4):
>    b = gtk.EventBox()
>    b.connect_after('event', event, i)
>    b.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
>                           gtk.DEST_DEFAULT_DROP |
>                           gtk.DEST_DEFAULT_HIGHLIGHT,
>                           [("application/x-bittorrent",
>                              gtk.TARGET_SAME_APP, TARGET_TYPE)],
>                           gtk.gdk.ACTION_MOVE)
>    b.connect_after('drag_motion', drag_motion, i)
>
>    b.set_border_width(10)
>    f = gtk.Frame('frame %d'%i)
>    b.add(f)
>    if last is None:
>        l = gtk.Label('middle')
>        e = gtk.EventBox()
>        e.set_border_width(10)
>        e.drag_source_set(gtk.gdk.BUTTON1_MASK,
>                             [("application/x-bittorrent",
>                                gtk.TARGET_SAME_APP, TARGET_TYPE)],
>                             gtk.gdk.ACTION_MOVE)
>        e.add(l)
>        f.add(e)
>    else:
>        f.add(last)
>    last = b
>
>w = gtk.Window()
>w.connect('destroy', lambda w: gtk.main_quit())
>w.add(last)
>w.show_all()
>gtk.main()

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to