Using a glade file with a Gtk::Window-based class

I'm using gtkmm 2.20.3 on Ubuntu 10.04.  I have a simple GLADE file that works with the following code:

   Glib::RefPtr< Gtk::Builder > builder;
   builder = Gtk::Builder::create_from_file( UI_FILE );
   Gtk::Window* mainWindow = NULL;
   builder->get_widget( "mainWindow", mainWindow );

After the get_widget call, mainWindow is a valid pointer.  If I create a class:

   class MainWindow : public Gtk::Window {};

and then try to use it:

   MainWindow* mainWindow = NULL;
   builder->get_widget( "mainWindow", mainWindow );

mainWindow remains NULL.  Is it possible to load a GLADE file into a derived window class?




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