Re: Gtk::Menu with libglademm



Am Sat, 6 Mar 2010 11:36:47 -0600 schrieb Kenneth Adam Miller:

Hello Kenneth,

I rewrote my code to use Gtk::Builder::create_from_file() logic, but as
result I get:

BuilderError: Invalid root element: 'glade-interface'

My glade file starts like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Mon Mar  1 22:21:23 2010 -->
<glade-interface>
  <widget class="GtkWindow" id="Application">
    <property name="visible">True</property>
    <property name="title" translatable="yes">Hello World!</property>
    <property name="default_width">500</property>
    <property name="default_height">400</property>
...

Any ideas about that problem?

regards
	Andreas

> It would be really simple to forget to put your equivalent of the
> line: Glib::RefPtr<Gtk::Builder> Builder =
> Gtk::Builder::create_from_file("test.glade");
> that is necessary to load the file in the first place. maybe this
> sounds trivial, but every now and then I forget to do something like
> this and someone tells me. you have to load the file before you can
> access the widgets.
> 
> On Thu, Mar 4, 2010 at 4:00 PM, Andreas Volz <lists brachttal net>
> wrote:
> 
> > Am Thu, 04 Mar 2010 20:26:35 +0100 schrieb Krzesimir Nowak:
> >
> > > On Wed, 2010-03-03 at 21:56 +0100, Andreas Volz wrote:
> > > > Hello,
> > > >
> > > > I've created a Gtk::Menu (GTKMenu) with Glade. In my project I
> > > > try to load it with libglademm:
> > > >
> > > > Gtk::Menu *mUmlEditMenu;
> > > > mXMLGlade->get_widget ("umlEditMenu", mUmlEditMenu);
> > > >
> > > > The result is:
> > > >
> > > > (state:7484): libglademm-CRITICAL **: widget `umlEditMenu' not
> > > > found in glade file
> > > > `/home/andreas/src/svn/state/trunk/src/state.glade'
> > > >
> > > > ** (state:7484): CRITICAL **: Gnome::Glade::Xml::get_widget():
> > > > dynamic_cast<> failed.
> > > >
> > > >
> > > > And yes the object exist. Look here in the state.glade:
> > > >
> > > >   <widget class="GtkMenu" id="umlEditMenu">
> > > >     <property name="visible">True</property>
> > > >     <child>
> > > >       <widget class="GtkImageMenuItem" id="umlEditDel">
> > > >         <property name="visible">True</property>
> > > >         <property name="label"
> > > > translatable="yes">gtk-delete</property> <property
> > > > name="use_underline">True</property> <property
> > > > name="use_stock">True</property> </widget>
> > > >     </child>
> > > >   </widget>
> > > >
> > > > Has anyone an idea why it's not working?
> > > >
> > > > My last option would be to construct the Gtk::Menu without
> > > > glade. :-(
> > > >
> > >
> > > I don't exactly know what are you doing or using, but there is
> > > onersion possibilty - you are using Glade to create GUI and save a
> > > result in GtkBuilder .xml format (which is now a default), which
> > > is
> > probably
> > > incompatible with libglade .xml format and now you are trying to
> > > load GtkBuilder using libglade. See one of two solutions:
> > > 1. Continue using libglade, but edit your glade .xml file in
> > > Glade and try to save it in Glade format.
> > > 2. Switch from libglade to GtkBuilder - libglade is deprecated
> > > anyway. GtkBuilder is wrapped in gtkmm.
> >
> > I'm still using Glade 3.4.5 and libgtkmm-2.4. I've seen no hint if I
> > should use GtkBuilder or libglade with this vesion.
> >
> > regards
> >         Andreas
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
> >


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