Re: missing button release event?
- From: Paul Emsley <paul emsley bioch ox ac uk>
- To: goocanvas-list gnome org
- Subject: Re: missing button release event?
- Date: Wed, 11 Jul 2012 14:07:48 +0100
On 07/11/2012 12:05 AM, Damon Chaplin wrote:
On Tue, 2012-07-10 at 23:40 +0100, Paul Emsley wrote:
On 10/07/12 20:33, Damon Chaplin wrote:
On Tue, 2012-07-10 at 17:48 +0100, Paul Emsley wrote:
Hi,
When I create a goocanvas
GtkWidget *canvas = goo_canvas_new();
GooCanvas *gc = GOO_CANVAS(canvas);
I then attached callbacks to it...
... other callbacks ...
g_signal_connect(G_OBJECT(goo_canvas_get_root_item(gc)),
"button_release_event",
G_CALLBACK(on_canvas_button_release), NULL);
This works fine almost all the time - however, there is one operation
(a line addition) where the on_canvas_button_release callback doesn't
get called (I added a print statement in it to check). I can't think
why it might not be being called. Can you help?
Cheers,
Paul.
p.s. code here: http://coot.googlecode.com/svn/trunk/lbg/lbg.cc
Are you creating an item underneath the mouse when the button is
pressed? The button release event may be being sent to that new item and
ignored.
I can't think of any other reason at the moment. It would be handy if
GooCanvas had some debugging support for events - i.e. output where
events are being sent.
Hi Damon,
Thanks for your prompt reply.
Yes, I am creating an item under the mouse (at least potentially). The
new line (a chemical bond, FWIW) changes (or can change) the text for
the atom (under the cursor).
I thought I had checked for that though by adding a button release
callback specifically when text is created. Maybe I missed one/some. Hmm.
Why is it that for this operation the callback is attached (or is at
least potentially attached) to the new text item, but for most other
mouse events (motion and button-down, for example) attaching callbacks
to the canvas works fine?
Is it more likely that the callback is attached to the text under the
cursor that gets deleted or the text under the cursor that is newly
created? Maybe if I created a text group to handle this and added and
deleted items from the group - would that be better do you think?
It shouldn't be that complicated.
I think you just need to check all your button release callbacks and
make sure they only return TRUE when they handled the event.
If they return TRUE it stops the event from propagating up to parent
items.
Hi Damon,
That's encouraging, thanks.
If I click on an item, drag to plain canvas and button-up, what should
get the button-up callback, canvas or item?
If I click on an item (as as a result, the item is deleted), drag to
plain canvas and button up, what (if anything) received the button-up
callback? (In my case it seems nothing).
Cheers,
Paul.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]