[Glade-users] Get a Widget-Pointer

Damon Chaplin damon@ximian.com
Mon, 30 Apr 2001 15:08:25 -0400


Konrad Mader wrote:
> 
> Hi,
> 
> I define with glade
> a top_level_window, named 'Hauptfenster',
> inside of 'Hauptfenster' a vbox named 'vbox2',
> inside of 'vbox2 a alignment named 'alignment1',
> inside 'alignment1' a clist named 'clist1'.
> 
> After a 'create_Hauptfenster()' I want to use
> gtk_clist_append(). How can I handle 'clist1'?

In the FAQ:

4.5 How do I get a pointer to a widget from within a signal handler?

If you have a pointer to any widget in a window, you can get a pointer
to
any other widget in the window using the lookup_widget() function that
Glade
provides (in support.c).

You pass it a pointer to any widget in a window, and the name of the
widget
that you want to get. Usually in signal handlers you can use the first
argument
to the signal handler as the first parameter to lookup_widget(), e.g.

void
on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
  GtkWidget *entry1;

  entry1 = lookup_widget (GTK_WIDGET (button), "entry1");

  ...
}



Damon