Re: Finding a widget in a Glade interface



On Sun, 03 Aug 2008 19:10:37 +0000
dhk <dhkuhl optonline net> wrote:
Is gtk_container_get_children() suppose to return a list of all children 
including children of children down to the last leaf or just the 
immediate children?  I only seem to get the immediate children.  Will 
gtk_container_foreach() or gtk_container_forall() go down all levels to 
the last leaf or just the next level?

Both work on immediate children. You must call them recursively,
something like that:

void
action(GtkWidget *widget)
{
  /* Do something */
}

void
callback(GtkWidget *widget)
{
  action(widget);
  if (GTK_IS_CONTAINER(widget))
      gtk_container_foreach(GTK_CONTAINER(widget),
                            callback, NULL);

}

gtk_container_foreach() is the way: the forall() version
traverses also internal stuff I think you don't care about.

Ciao
-- 
Nicola



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