Re: missing button release event?



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?

Cheers,

Paul.




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