I met a windows display error. Please help me.

 

I create two windows in glade file. one window is main window with menus. The 
other (sub window) will be displayed after clicking a menu item. After clicking 
the menu item, the window appear very shortly and disappeared. you can see a 
window flashing one time on the screen.

 

 

The sub window header file is :




#include <gtkmm.h>
#include <iostream>

class GardenPresent
{
    public:
      GardenPresent(Gtk::Window& parent);
      virtual ~GardenPresent();


      Gtk::Window* get_window();
          
  private:


   Gtk::Window* wndGardenPresent;

  
   int load_ui();
};

 
The sub window cc file is :
 


#include "GardenPresent.h"

GardenPresent::GardenPresent(Gtk::Window& parent)
{
 load_ui();
 wndGardenPresent->set_transient_for(parent);
}

GardenPresent::~GardenPresent() 
{
 delete wndGardenPresent;
}
 

Gtk::Window* GardenPresent::get_window()
{
   return wndGardenPresent;
}

int GardenPresent::load_ui()
{

    Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();

        refBuilder->add_from_file(mnuPresent_glade_file);

    refBuilder->get_widget("wndGardenPresent", wndGardenPresent);
 
    return 0;
}


The menu item signal handler is :


 
void gkass::on_mnuGardenPresent_activate()
{
 
  GardenPresent GardenPresent1(*gkassWindow);
  
  GardenPresent1.get_window()->show(); 
  
} //The window appears on show() and disappears after this handler end. 
 
 
I try to use a gtk::dialog instead of gtk::window. The dialog can display 
normally. So I think maybe gtkmm only allow one window exist in a program. Is 
it right ?
 
Thanks
 
Wallace.
 

_________________________________________________________________
Messenger安全保护中心,免费修复系统漏洞,保护Messenger安全!
http://im.live.cn/safe/
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to