Re: Routing scroll events in a Gtk.Overlay

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

 



On Thu, Jun 5, 2014 at 2:34 PM, Paul Davis <paul@xxxxxxxxxxxxxxxxxxxxx> wrote:
On Thu, Jun 5, 2014 at 2:11 PM, Robert Schroll <rschroll@xxxxxxxxx> wrote:
So I guess my question becomes, how can a parent (the EventBox) prevent a certain type of event (scrolling) from being delivered to its children.

standard solution to such a question is "return true from its own handler".

I'm obviously misunderstanding something, because that isn't working for me. In the test program below, there's an EventBox containing a SpinButton. The EventBox has a scroll-event handler that returns True. But when you scroll over the SpinButton, this handler is (almost) never called. Instead, the SpinButton consumes these events. If you uncomment the set_above_child line, then the EventBox gets the scroll events, but it also gets the click events, so you can no longer adjust the SpinButton by clicking on its buttons.

Now, I could keep the SpinButton from spinning by having a scroll-event handler for the SpinButton return True. For this example, it'd work fine. But in the circumstance where I have many children, grand-children, great-grand-children, etc. of the EventBox, that gets tedious.

Can you straighten me out?  Thanks,
Robert

=== eventtest.py ===
from gi.repository import Gtk, Gdk

win = Gtk.Window()
eb = Gtk.EventBox()
sb = Gtk.SpinButton(adjustment=Gtk.Adjustment(50, 0, 100, 1, 5, 0))

eb.add(sb)
#eb.set_above_child(True)
win.add(eb)
win.set_default_size(200, 200)
win.connect('destroy', Gtk.main_quit)

def eb_scroll(widget, event):
   print "Event Box scroll event"
   return True
eb.connect('scroll-event', eb_scroll)

win.show_all()
Gtk.main()



_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux