Re: [gtk-list] Find a widget by name



Bernd Demian wrote:
> 
> Hi,
> who can help me, I'm searching for a method to find a widget by name
> from the toplevelwidget beginning.
> I found a function generated by 'glade', but it does not work.
> 
>   if (widget->parent)
>     widget = gtk_widget_get_toplevel (widget);
>   found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT
> (widget),name);
> 
> I look in source code - IMHO i can't work.
> Can you help me
> Bernd
> 

Hello,

You probably haven't read the rest of the code created by glade? It does
the following: (lets say 'root' is your root widget (window) and 'w' the
widget you wanne reference)

gtk_object_set_data (GTK_OBJECT (root), "widget name", w);

So, it sets a string (name in your piece o' code) connected to the
widget in the root widget.

yours,

_A_ 

Arjan Molenaar



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