[Glade-users] Problems with lookup_widget()

James Cameron james.cameron@compaq.com
Wed, 14 Feb 2001 09:17:39 +1100


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.

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.  In my
gfocustimer application, I have a struct for the dialog that contains
the pointer and other stuff.  There are, of course, other ways to have
the dialog remember the related widget.

http://quozl.linux.org.au/gfocustimer/

-- 
James Cameron                                 (james.cameron@compaq.com)

http://quozl.linux.org.au/         (or)         http://quozl.netrek.org/