I need to detect when the mouse pointer leaves an area in a GtkNotebook. Normally this is possible with the motion_notify event, but if the pointer is moved fast enough, the event is not triggered. Because this is a certain area of pixels in a GtkNotebook, it is not possible to use a GtkEventBox. What is the proper way to do this?
+3
A:
You should use enter-notify-event
and leave-notify-event
signals.
dmitry_vk
2009-07-01 19:04:22
These aren't working for me, and anyway, I want to know when I leave an area, not the whole control.
c4757p
2009-07-06 17:14:02
A:
You are guaranteed to get enter and leave notifications, but only periodic motion notifications. if the pointer is moving fast enough, you won't get a notification for coordinates within the area you care about.
The only way to catch this 100% is to bulid an EventBox (or some other windowed widget) into your widget hierarchy that does encapsulate this space. Keep in mind that you may be able to define the region in terms of multiple widgets.
Finally, if you aren't receiving enter or leave notifications from a widget, you likely have to modify the widget's event mask.
myWidget->add_events(Gdk::ENTER_NOTIFY_MASK);
anthony
2009-07-09 23:27:52
Wow --- can't believe I never even realized I'd have to modify an event mask to do this. I didn't know there *was* one. I'll have to take a look at that. Thank you
c4757p
2009-07-18 11:05:45