Re: menu doesn't have ancestor?



On Fri, Jul 27, 2001 at 03:36:58PM -0400, Havoc Pennington wrote:
> >   When I do:
> >   
> >   anc = gtk_widget_get_ancestor (button1, GTK_TYPE_WINDOW);
> > 
> >   inside a button1 callback, it returns a pointer to the ancestor window.
> > 
> >   But if I do it inside a menu item callback (changing button1 to menuitem1)
> >   it doesn't work.
> > 
> >   Any hints?
> 
> GtkMenu is a toplevel, so the menu items are not inside a GtkWindow.
> 
> Easiest thing is to set the GtkWindow on the menu items with
> gtk_object_set_data().

mmm, I see...

  I have four identical windows that have menus.
  How could the menu callback function know which menu in which of the four windows was it called from?

  I solved this in the button with the get_ancestor function.

  Thanks
    Pedro




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