Re: Moveable Goocanvas::Widgets

thanks, gtk_widget_set_events() did the trick.



Damon Chaplin wrote:
On Sun, 2009-02-22 at 13:51 +0100, Robert Gründler wrote:

This resulted in the next workaround, listening to the motion notify event on the canvas itself, handling the dragging logic in there, which brought me to a point where i'm really stuck now. The motion_notify_event from the Goocanvas::Canvas itself is dispatched correctly, even if the mouse is over a child Widget. However, i'm not receiving the signal anymore as soon as the left mouse button is clicked on a widget on the canvas...

_canvas->signal_motion_notify_event().connect(sigc::mem_fun(*this, &MyWindow::on_canvas_motion_notify_event, false);

bool MyWindow::on_canvas_motion_notify_event(GdkEventMotion* event) { // <-- not called when the mouse button has been pressed on a widget on the canvas std::cout << "motion detected" << std::endl; }

It might be better to connect to the "event" signal of the embedded
widgets. That way you should get all the events aimed at the widget
before anything gets a chance to interfere.

Also, make sure you call gtk_widget_set_events() on the embedded widget
with all the types of events you need.


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