Re: list of all child widgets

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

 



On Mon, Jul 11, 2005 at 04:47:14PM -0400, Tristan Van Berkom wrote:
> 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.


Ahh, thanks.  I take it that 'list' should be '&list' in the internal
gtk_container_foreach().

The reason why I asked is that I was looking to trigger 'activate'
signal on all Entry widgets when I exit the dialog window.  I can use
'changed' signal, but it seems a little strange to save on every
character edit.  Though, computer is fast enough and won't make a
difference in my case.

-- 
William Park <opengeometry@xxxxxxxx>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
	   http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
	  http://freshmeat.net/projects/bashdiff/
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux