get_widget out of GtkBuilder xml file in C-Code

View: New views
2 Messages — Rating Filter:   Alert me  

get_widget out of GtkBuilder xml file in C-Code

by scrapper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello friends of GLADE,
       
        how do i get a pointer to a widget built with glade, which is
        called by
        the generated GtkBuilder xml file "statusbar1"!?
       
         builder = gtk_builder_new ();
         gtk_builder_add_from_file (builder, "myproject.glade", NULL);
       
         i tried several things like this:
       
        GtkWidget* statusbar;
       
        statusbar = glade_xml_get_widget(builder, "statusbar1");
        and other things. but nothing worked for me.
       
        error message i get:
        implicit declaration of function ‘glade_xml_get_widget’
       
        i know this is not the GladeXML type
        builder is GtkBuilder type.
       
        Is there a way to get the widget from the GtkBuilder xml file,
        to show / hide this widget by the following method or another
        one?
       
         gtk_widget_hide(statusbar);
         gtk_widget_show(statusbar);
       
        thanks a lot
        i really was looking for this 2 days now.
       
        greetings
        Scrapper

_______________________________________________
Glade-users maillist  -  Glade-users@...
http://lists.ximian.com/mailman/listinfo/glade-users

Re: get_widget out of GtkBuilder xml file in C-Code

by Alexey Kurochkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-10-08 at 16:42 +0200, msp430 wrote:

> hello friends of GLADE,
>        
>         how do i get a pointer to a widget built with glade, which is
>         called by
>         the generated GtkBuilder xml file "statusbar1"!?
>        
>          builder = gtk_builder_new ();
>          gtk_builder_add_from_file (builder, "myproject.glade", NULL);
>        
>          i tried several things like this:
>        
>         GtkWidget* statusbar;
>        
>         statusbar = glade_xml_get_widget(builder, "statusbar1");
>         and other things. but nothing worked for me.
>        
>         error message i get:
>         implicit declaration of function ‘glade_xml_get_widget’
>        
>         i know this is not the GladeXML type
>         builder is GtkBuilder type.

statusbar = GTK_WIDGET (gtk_builder_get_object (builder, "statusbar1"));

>        
>         Is there a way to get the widget from the GtkBuilder xml file,
>         to show / hide this widget by the following method or another
>         one?
>        
>          gtk_widget_hide(statusbar);
>          gtk_widget_show(statusbar);
>        
>         thanks a lot
>         i really was looking for this 2 days now.

Did you try to look in the documentation?
http://library.gnome.org/devel/gtk/stable/GtkBuilder.html

>        
>         greetings
>         Scrapper
>
> _______________________________________________
> Glade-users maillist  -  Glade-users@...
> http://lists.ximian.com/mailman/listinfo/glade-users


_______________________________________________
Glade-users maillist  -  Glade-users@...
http://lists.ximian.com/mailman/listinfo/glade-users