[prev in list] [next in list] [prev in thread] [next in thread]
List: gtkmm
Subject: Re: Cannot get button press event on drawing area
From: Kjell Ahlstedt via gtkmm-list <gtkmm-list () gnome ! org>
Date: 2019-03-02 9:02:33
Message-ID: 26de6d2e-b84d-fade-38b8-9d64731c1f4a () gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On 2019-03-01 17:28, Kjell Ahlstedt wrote:
> On 2019-03-01 16:58, Радомир Хаџић wrote:
>> Also, I did try to change set_events to add_events but again, nothing changed.
>>
>> 2019-03-01 14:27 GMT+01:00, Радомир Хаџић<radomirhadzic46@gmail.com>:
>>> Sorry, I meant "BUTTON1_MOTION_MASK," but it doesn't really matter.
> Yes, it does matter. Like you say, you have BUTTON1_MOTION_MASK, but
> you should have BUTTON_PRESS_MASK. Button motion is not the same as
> button press. First a button is pressed, then the pointer is moved
> with the button pressed, then the button is released. That's three
> different kinds of events.
Alternatively, you can set Gdk::BUTTON1_MOTION_MASK and connect to
signal_motion_notify_event(). Or set several mask bits and connect to
several event signals. Anyway, you must set a mask bits that correspond
to the event signals you connect to.
>>> 2019-03-01 14:26 GMT+01:00, Радомир Хаџић<radomirhadzic46@gmail.com>:
>>>> But do I not have
>>>>
>>>> get_window()->set_events(Gdk::EventMask::BUTTON1_PRESS_MASK);
>>>>
>>>> on line 21?
>>>>
>>>> 2019-03-01 11:03 GMT+01:00, Kjell Ahlstedt<kjellahlstedt@gmail.com>:
>>>>> 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.
>>>>>>
>>>>>>
[Attachment #5 (text/html)]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix"><font size="-1">On 2019-03-01 17:28,
Kjell Ahlstedt wrote:</font><br>
</div>
<blockquote type="cite"
cite="mid:dc810f1f-c965-0147-9f5b-314566982e9b@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="moz-cite-prefix"><font size="-1">On 2019-03-01 16:58,
Радомир Хаџић wrote:</font><br>
</div>
<blockquote type="cite"
cite="mid:CAPV9uWuJ=vv7WYXTnJkp2wWZG=NAXFnqnt4fiVLPDfTzUoM1vw@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">Also, I did try to change set_events to \
add_events but again, nothing changed.
2019-03-01 14:27 GMT+01:00, Радомир Хаџић <a class="moz-txt-link-rfc2396E" \
href="mailto:radomirhadzic46@gmail.com" \
moz-do-not-send="true"><radomirhadzic46@gmail.com></a>: </pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Sorry, I meant "BUTTON1_MOTION_MASK," \
but it doesn't really matter.</pre> </blockquote>
</blockquote>
<font size="-1">Yes, it does matter. Like you say, you have
BUTTON1_MOTION_MASK, but you should have BUTTON_PRESS_MASK.
Button motion is not the same as button press. First a button is
pressed, then the pointer is moved with the button pressed, then
the button is released. That's three different kinds of events.<br>
</font></blockquote>
<font size="-1">Alternatively, you can set </font><font size="-1">
Gdk::BUTTON1_MOTION_MASK and connect to
signal_motion_notify_event(). Or set several mask bits and connect
to several event signals. Anyway, you must set a mask bits that
correspond to the event signals you connect to.<br>
</font>
<blockquote type="cite"
cite="mid:dc810f1f-c965-0147-9f5b-314566982e9b@gmail.com"><font
size="-1"> </font>
<blockquote type="cite"
cite="mid:CAPV9uWuJ=vv7WYXTnJkp2wWZG=NAXFnqnt4fiVLPDfTzUoM1vw@mail.gmail.com">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">2019-03-01 14:26 GMT+01:00, Радомир \
Хаџић <a class="moz-txt-link-rfc2396E" href="mailto:radomirhadzic46@gmail.com" \
moz-do-not-send="true"><radomirhadzic46@gmail.com></a>: </pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">But do I not have
get_window()->set_events(Gdk::EventMask::BUTTON1_PRESS_MASK);
on line 21?
2019-03-01 11:03 GMT+01:00, Kjell Ahlstedt <a class="moz-txt-link-rfc2396E" \
href="mailto:kjellahlstedt@gmail.com" \
moz-do-not-send="true"><kjellahlstedt@gmail.com></a>: </pre>
<blockquote type="cite">
<pre class="moz-quote-pre" \
wrap="">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:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">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:
<a class="moz-txt-link-freetext" href="https://pastebin.com/Dr3Av2vJ" \
moz-do-not-send="true">https://pastebin.com/Dr3Av2vJ</a>.
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic