Re: Cannot get button press event on drawing area



   get_window()->set_events(Gdk::EventMask::BUTTON_PRESS_MASK);
or
   add_events(Gdk::EventMask::BUTTON_PRESS_MASK);

If you want to receive button press events, then set the button press mask. If you want to receive button motion events, then set a button motion mask.

It's usually better to use Gtk::Widget::add_events() instead of Gdk::Window::set_events() or Gtk::Widget::set_events().

If you don't want other handlers to receive the event, then it's correct to let draw_get_mouse() return true.

On 2019-02-28 20:39, Радомир Хаџић wrote:
I did what you said but it didn't work for me. I changed

signal_button_press_event().connect(sigc::mem_fun(*this,
&DrawingArea::draw_get_mouse));

to

signal_button_press_event().connect(sigc::mem_fun(*this,
&DrawingArea::draw_get_mouse), false);

but nothing changed. I also tried changed return value of
draw_get_mouse to false even though I don't want to propagate that
signal to other handlers.

I'm also sending modified code, which is also available here:
https://pastebin.com/Dr3Av2vJ.




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