Re: list of all child widgets
- From: William Park <opengeometry yahoo ca>
- To: Tristan Van Berkom <tvb gnome org>
- Cc: gtk-list gnome org
- Subject: Re: list of all child widgets
- Date: Mon, 11 Jul 2005 15:58:03 -0400
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 yahoo ca>, 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/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]