Re: list of all child widgets



William Park wrote:
Hi, I just signed up.

How do I get a list of all child widgets, recursively down the
hierarchy?

GList *list = NULL;
gtk_container_foreach (widget, foreach_func, &list);


foreach_func (GtkWidget *widget, GList **list)
{
      *list = g_list_append (*list, widget);
      if (GTK_IS_CONTAINER (widget)) {
          gtk_container_foreach (widget, foreach_func, list);
      }
}

Cheers,
                      -Tristan

Note that you can use gtk_window_list_toplevels(); to get your
top-levels, then you can use the above code to get all widgets
in the application.



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