Re: [gtk-list] widget name

On Fri, 24 Mar 2000, wrote:
> I create several buttons and set names for them.
> Can I later in different function reach the button using it's name?
YES use :
GtkWidget *
 get_widget(GtkWidget * widget, gchar * widget_name)
    GtkWidget *parent, *found_widget;

    for (;;) {
	if (GTK_IS_MENU(widget))
	    parent = gtk_menu_get_attach_widget(GTK_MENU(widget));
	    parent = widget->parent;
	if (parent == NULL)
	widget = parent;

    found_widget = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(widget),
    if (!found_widget)
	g_warning("Widget not found: %s", widget_name);
    return found_widget;

> Thanks,
> Didi

Andreas Scherf    

"It said uses Windows 98 or better, so I loaded Linux!"

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