[gtkmm] Gnome Canvas Item not getting Button press event



I have a Canvas class that defines a method on_button_press_event, such
that when it gets clicked it draws a circle. This  circle is an object
of a class derived from Gnome::Canvas::Ellipse.

The thing is that I would like the item to receive button press events,
but it seems not to. It gets other events such as GDK_ENTER_NOTIFY or
LEAVE. My on_event method is:

...
 virtual bool on_event(GdkEvent *e)
  {
    Ellipse::on_event(e);

    if(e->type == GDK_BUTTON_PRESS)
      cout << "Button press" << endl;
     if(e->type == GDK_ENTER_NOTIFY)
      {
       
        cout << "Pointer enters" << endl;
      }

    if(e->type == GDK_LEAVE_NOTIFY)
      {

        cout << "Pointer leaves" << endl;
      }

    return false;
  }
...

As I understand it, events should travel up the stack of the canvas,
beginning at the front-most item and ending up in the canvas if noone
else has taken care of it.

Watching the "arrowhead" demo I can't tell what's wrong. Any help would
very appreciated.

Thank you very much.




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