Re: How to find a widget contained witin a widget



    Alan> How can I access a widget contained in a window with only the window
    Alan> pointer available.  It looks like gtk_container_children() might do
    Alan> this, but the documentation only gives a funtion prototype.  What
    Alan> exactly is the Glist returned by gtk_container_children(), and how
    Alan> would I use it to tell the difference between a gtkbutton and a
    Alan> gtkcombo?

Something like:

for (l = gtk_container_children(thing); l != NULL; l = l->next) {
  if (GTK_IS_BUTTON(GTK_OBJECT(l->data)))
    g_print("BUTTON\n");
  else if (GTK_IS_COMBO(GTK_OBJECT(l->data)))
    g_print("COMBO\n");
}

-----------------------------------------------------------------------------
Mark Leisher
Computing Research Lab            Once you fully apprehend the vacuity of a
New Mexico State University       life without struggle, you are equipped
Box 30001, Dept. 3CRL             with the basic means of salvation.
Las Cruces, NM  88003                            -- Tennessee Williams





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