[gtkmm] mouse button event



hi,
I'm looking for a way to find out if a mouse button was pressed
and where it was clicked.

I thought the button_press_event is responsible for that. But
it seems that it doesn't work.

The following code prints nothing if I click onto the window
(using gtkmm 2.2.2-1)

#include <gtkmm.h>
#include <iostream>

bool button_press_event(GdkEventButton*) {
  std::cout << "button press event" << std::endl;
  return true;
}

int main(int argc, char **argv) {
  Gtk::Main kit(argc,argv);
  Gtk::Window win;
  win.signal_button_press_event().connect(button_press_event);
  kit.run(win);
}

Is there another way to find out if a mouse button was pressed?

regards,
Ruediger Sonderfeld <cplusplushelp gmx net>



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