Re: Help! (Losing widget names)



On Wed, 2002-03-20 at 08:34, David Eduardo Gomez Noguera wrote:
> On 20 Mar 2002 21:02:56 +0800
> John Breen <locutus borg apana org au> wrote:
> 
> > On Wed, 2002-03-20 at 20:56, David Eduardo Gomez Noguera wrote:
> > > On 20 Mar 2002 18:29:42 +0800
> > > John Breen <locutus borg apana org au> wrote:
> > > 
> > > You are using glade, right?
> > yes
> > 
> > > 
> > > Glade uses gtk_object_data_set/get on the parent GtkWindow Widget with every widget that is inside it and its name. lookup_widget is just a glade function that uses gtk_object_data_get to get the widget back. So your function should update that information too.
> > > 
> > > 
> > ok, but consider:
> > 
> > window1
> > |
> > +- frame1
> >    |
> >    +- clist1
> > 
> > window2
> > 
> > now, if i reparent frame1 to window2, so that i have
> > 
> > window1
> > 
> > window2
> > |
> > +- frame1
> >    |
> >    +- clist1
> > 
> > clist1 ALSO gets moved to window2.  I don't want to have to enumerate
> > through all the children of frame1 setting all its childrens' names....
> > 
> > I Delphi/Kylix (Kylix uses QT), it doesn't lose object name
> > properties....
> > 
> 
> glade generates a file named support.c and support.h
> see if there is any function that helps. (i dont know its content, but lookup_widget is defined there).
> but i dont think so.
> anyway, widget_lookup is something implemented by glade, not gtk. and this time you would only be updating info for two widgets.
> If its a problem, it might be a good idea to ask and/or help glade developers make a wrapper (is this word used rright?) for reparenting widgets that does that too. (maybe its already there, but i dont know).
> Check on glade site.
> 

The problem is that lookup_widget() traverses up the child->parent chain
from any widget to the toplevel widget, then does a
gtk_object_get_data() so when you move the widget to another toplevel
window the data "*widget_name" is left on window1. The best thing would
probably be to gtk_object_remove_data() the name on window1 and
gtk_object_set_data() on window2 to make lookup_widget work.

-- 
Stephen




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