Re: Locating child-widgets (by name) without Glade-code



On Fri, 2003-08-15 at 11:46, Gus Koppel wrote:
Is there an (official) way in GTK+ 2.2 to get a pointer to a GtkWidget
by the name of the widget, like Glade imposes it by its lookup_widget
()-function and GLADE_HOOK_OBJECT ()-lists?

Since I intend to create, remove and modify widgets dynamically at
runtime on my own I can't / don't want to make use of Glade's extensions
(if it's avoidable).

And if there isn't a similar GTK+-function (as I suppose), is using
gtk_container_get_children () and recursively comparing the names of the
children against the searched one the correct + most efficient way?

I don't really see any reason to look up children by name if you
aren't using Glade or libglade. Just keep pointers to the children
you need to reference.

gtk_widget_set_name() is *not* meant for this purpose; it's rather 
meant for the purposes of theming particular widgets; trying to search
for widget names set by gtk_widget_set_name() is going to be slow,
and GTK+ does not enforce uniqueness.

Regards,
                                                Owen





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