RE: [gtkmm] Double Window Hell



1. I think that get_derived_widget() should make this much simpler.
2. I think that add() is much simpler than reparent_window().

The libglademm examples should show this. If the libglademm examples don't
show how to do something, then please tell us what they don't show.

Murray Cumming
www.murrayc.com
murrayc usa net

> -----Original Message-----
> From: gtkmm-list-admin gnome org 
> [mailto:gtkmm-list-admin gnome org] On Behalf Of Jeffrey S. Gavin
> Sent: Mittwoch, 17. Dezember 2003 16:59
> To: Dennis Craven
> Cc: gtkmm-list gnome org
> Subject: Re: [gtkmm] Double Window Hell
> 
> 
> Dennis Craven wrote:
> 
> >Hey folks,
> >
> >This is something probably pretty simple, but it is making me quite 
> >angry. I've used regular GTK+ before, but this is my first 
> time using 
> >gtkmm and also my first libglade(mm) attempt. The problem is 
> that when 
> >I execute my code, I get two windows; one that I intended on 
> getting, 
> >and one that is just a blank window with the title "main". 
> It appears 
> >that the mystery window is dominant, as it is the only one 
> (when it's 
> >wm close button is clicked) that will kill the application.
> >  
> >
> I use gtkmm and libglademm daily, so maybe I can help here.  I 
> experienced the same frustration when I started as well.  Here is my 
> solution (workaround) to this behavior.
> 
> For each window that I design using glade-2, I make sure the Visible 
> Property is set "no" for the window.  Here is a snip of code 
> that I cut 
> and paste for each class that controls a window:
> 
> class winCinque : public Gtk::Window
> {
>    
>     public:
>         winCinque();
> ...
> 
>     private:
>         Gtk::Container *applicationspace;
>         Gtk::Container *workspace;
>         Gtk::Container *searchspace;
> ...
> };
> 
> winCinque::winCinque()
> {
>     m_refGlade = Gnome::Glade::Xml::create(config.gladePath + 
> "main/winCinque.glade");
>     m_refGlade->reparent_widget("ApplicationSpace", *this);
>     m_refGlade->get_widget ("ApplicationSpace", applicationspace);
>     m_refGlade->get_widget ("WorkSpace", workspace);
>     m_refGlade->get_widget ("SearchSpace", searchspace);
>    
>      //Connect signal handlers:
> 
>     // When the original glade window is reparented to this window 
> object, we
>     // loose the old window settings. So, we just copy the 
> settings from 
> the
>     // old window to this window.
>     //
>     // {}TODO: Did we get all the properties that we need?
>     //
>     Gtk::Window *original;
>     m_refGlade->get_widget ("winCinque", original);
> 
>     this->set_title        (original->property_title());
>     this->set_modal        (original->property_modal());
>     this->set_position     (original->property_window_position());
>     this->set_size_request (original->property_default_width(),
>                             original->property_default_height());
>     this->set_icon         (original->property_icon());
>     this->set_resizable    (original->property_resizable());
>    
>     // {}TODO: These are the properties that could not be set:
>     //
>     //    Glib::PropertyProxy<bool> property_allow_shrink();
>     //      Glib::PropertyProxy<bool> property_allow_grow();
>     //      Glib::PropertyProxy<bool> property_destroy_with_parent();
> 
>     show_all_children();
> 
> ...
> 
> }  
> 
> >Here is a bit of the code that I have:
> >
> >  
> >
> <snip code sample>
> 
> >I don't know if the contents of the .glade file is of 
> importance, but 
> >it maybe since my code doesn't look much different than the examples 
> >that came with the packages. Could it be that the problem 
> lies in the 
> >.glade file? Is there any documentation for the 
> gtkmm/libglademm combo? 
> >If I ever get this figured out, I might write up a simple tutorial 
> >myself.. Something just to get people started using these 
> two packages 
> >in unison.
> >
> >Thanks in advance,
> >~arker
> >
> >_______________________________________________
> >gtkmm-list mailing list
> >gtkmm-list gnome org 
> http://mail.gnome.org/mailman/listinfo/gtkm> m-list
> >
> >  
> >
> 
> 
> 
> 
> _______________________________________________
> 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]