Re: Gtk::DrawingArea with Cairomm from Glade - no Event



You don't need an event box. I inherited from Gtk::DrawingArea and put
this in the constructor:

this->add_events(Gdk::POINTER_MOTION_MASK
		| Gdk::POINTER_MOTION_HINT_MASK
		| Gdk::BUTTON_PRESS_MASK
		| Gdk::LEAVE_NOTIFY_MASK);

Obviously I wanted to track the pointer motion as well ( for my
rudimentary drawing app ). Also, make sure your DrawingArea is
sensitive.

On Thu, 2010-01-28 at 19:24 +0100, Andreas Volz wrote:
> Hello,
> 
> I placed a Gtk::DrawingArea in Glade and realized it with cairomm. All
> drawing on this surface works, but I get only expose events. Even if I
> overwrite the on_event() functions I see not any more events. I'm
> interested in the mouse button/position events. My first idea was to
> use 
> 
> set_events (Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK |
> Gdk::BUTTON_RELEASE_MASK);
> 
> but this results in:
> 
> (state:15062): Gtk-CRITICAL **: gtk_widget_set_events: assertion
> `!GTK_WIDGET_REALIZED (widget)' failed
> 
> Do I have to place my Gtk::DrawingArea in a Gtk::EventBox o catch my
> mouse events? Any other hints?
> 
> regards
> 	Andreas
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




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