RE: [gtkmm] Noticing on window's close



Manuel,

You should connect a signal to the window's signal_hide() event handling
mechanism.  Here is an example of using a dialog from my main window:

class TelnetApp : public Gnome::UI::App
{
public:
	TelnetApp();
	virtual ~TelnetApp();
	
protected:
	virtual void on_about_hide();
	Gnome::UI::About* m_pAbout;
};


TelnetApp::TelnetApp() : 
	// Wish there was an easier way to do all this
	Gnome::UI::App(PACKAGE,PACKAGE" v."VERSION),
	m_pAbout(0)
{
	if(m_pAbout) // "About" box hasn't been closed, so just raise it
	{
		Glib::RefPtr<Gdk::Window> refAboutWin =
m_pAbout->get_window();
		refAboutWin->show();
		refAboutWin->raise();
	}
	else
	{
		std::vector<Glib::ustring> authors;
		authors.push_back("Dale Hirt <dale sbcltd com>");
		
		std::vector<Glib::ustring> documenters;
		documenters.push_back("Dale Hirt <dale sbcltd com>");
		
		m_pAbout = new Gnome::UI::About(PACKAGE, VERSION,
					"", authors, documenters,
					_(""), "");
		
		m_pAbout->set_transient_for(*this);
		m_pAbout->signal_hide().connect(SigC::slot(*this,
&TelnetApp::on_about_hide));
		m_pAbout->show();
	}
}

void TelnetApp::on_about_hide()
{	
	if(m_pAbout)
	{
		delete m_pAbout; //Destroys and closes it.
		m_pAbout = 0;
	}
}



-----Original Message-----
From: Manuel Clos [mailto:llanero eresmas net]
Sent: Saturday, September 14, 2002 11:10 AM
To: gtkmm-list gnome org
Subject: [gtkmm] Noticing on window's close


Hi all,

The PORTING document says:

You do not need to connect to Gtk::Window's "delete_event" signal just to
  26   prevent self-destruction of the window, or to quit the application
  27   appropriately. In most cases you should just use the new
  28   Gtk::Main::run(window) override that shows the window and quits 
when it
  29   is hidden.

do these mean the delete_event is gone? I have tried both

delete_event_impl(GdkEventAny* e)
on_delete_event_impl(GdkEventAny* e)

and it don't seem to be called on window close.

I have a toplevel window, and I must notice when other Gtk::Window are 
closed.

How should I do this now with gtkmm2??

Thanks.

-- 
Manuel Clos
llanero eresmas net

TCPA y Palladium: http://bulmalug.net/body.phtml?nIdNoticia=1398
TCPA and Palladium: http://www.cl.cam.ac.uk/~rja14/tcpa-faq.html

_______________________________________________
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]