Re: [gtk-list] Re: widget name



Andreas Scherf wrote:
> 
> On Fri, 24 Mar 2000, didi@altatech.com 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 :
I could not get it work, What parameter-widget you pass to this function
> 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));
>         else
>             parent = widget->parent;
>         if (parent == NULL)
>             break;
>         widget = parent;
>     }
> 
>     found_widget = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(widget),
>                                                      widget_name);
>     if (!found_widget)
>         g_warning("Widget not found: %s", widget_name);
>     return found_widget;
> }
> 
> > Thanks,
> > Didi
> 
> MfG
> Andreas Scherf
> 
> scherfa@fh-trier.de
> http://www.fh-trier.de/~scherfa
> 
> "It said uses Windows 98 or better, so I loaded Linux!"
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null



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