Re: Implementing gnome canvas items



>  I'm trying to implement a "background item" for the canvas which is invisible,
>  but catches all events on the background. I need it so I can change the
>  behaviour of the normal canvas event handling (which is to catch all events,
>  whether or not they are caught by an item). Unfortunatly, my new item doesn't
>  catch any event. I can't figure out why. I just took the image item and stripped
>  out all the rendering code... while making my new item "infinite". I'm sending
>  the code in attachment. Does anyone have an idea of what I did wrong?
[snip]
>  static double
>  gnome_canvas_background_point (GnomeCanvasItem *item, double x, double y,
>                            int cx, int cy, GnomeCanvasItem **actual_item)
>  {
>     return 0.0;
>  }

You forgot to do 

	*actual_item = item;

The::point() method has two return values; one is the item that was
actually hit, if any, and the other one is the distance to that item.
The item that was actually hit is needed because the canvas needs to
figure out the current item when you have nested groups.

  Federico



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