[Glade-users] Problems with lookup_widget()

Sarah Mount s.mount@coventry.ac.uk
Wed, 14 Feb 2001 09:25:00 +0000 (GMT)


On Wed, 14 Feb 2001, James Cameron wrote:

> Sarah Mount wrote:
> > My widget tree looks a bit like this:
> > 
> > main_window
> > +
> > |___stuff
> > 
> > my_dialog
> > +
> > |___stuff
> >     +
> >     |___my_gnome_entry
> 
> Well carved.  I understood.

:-)
 
> > Now, I have a callback on_my_dialog_ok_clicked() and in there I want
> > to lookup the main_window widget. No combination of
> > lookup_widget(some_widget, "main_window") seems to work (the app
> > compiles but segfaults).
> 
> Yes.  Expected.  lookup_widget() must be given another widget within
> the same top level widget.

That's what I suspected...
 
> The way I solve this is to retain at least a widget pointer to my
> logical parent window widget, or the button that triggered it.  

Ah...now I thought of this. I already have globals that are pionters to my
dialog boxes, but not one to my main_application widget. Thing is, where
do I set it? With the dialog boxes I set the globals when the widgets are
created, but the main_application widget already exists. Argh!

Thanks for your help,

Sarah