Re: A gnome canvas question...



>       I have a programming question about the gnome canvas. I've
>  a good knowledge of the tk canvas widget and what is possible to
>  do with it, so I wonder how I can make the gnome canvas events
>  on gnome canvas background behaves like events on canvas items
>  or groups. The current behavior is that signal handler on the canvas
>  overrides events management on canvas items. How can I deal with
>  this problem ?

You can do one of two things.

	- Derive a class from the canvas and in your event handlers do

	  static gint
	  my_button_press_handler (GtkWidget *widget, GdkEventButton *event) 
	  {
		  if ((* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event))
			  return TRUE;

		  /* Do your own stuff here */
		  ....
	  }

	  The effect of this is to let the base canvas event handlers
	  synthesize the appropriate events for canvas items.  If no
	  item handles the event, then the return value will be FALSE,
	  so you can do your own stuff if this happens.

	- Create a custom canvas item that paints nothing in its ::draw
          method, always returns containment in its ::point method,
          and has some huge bounding box.

  Federico



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