Re: destroying (by closing) a modeless GtkMessageDialog ?



Hello All,

I (Basile) asked:
> What is the correct way to implement a modeless 
> Gtk::MessageDialog which is *destroyed* when its CLOSE button is activated, 
> or when the underlying window is closed?
> 
> My MyDialog class (subclass of Gtk::MessageDialog) has a Glib::RefPtr<MyDialog> 
> somewhere (for simplicity, you could assume in the main application window). 
> 

On Thu, Jun 07, 2012 at 04:20:46PM +0200, Giuseppe Penone wrote:
> > Hi,
> > I use a function like this:
> > 
> > void  Centro::dialog_error(const char *display_msg)
> > {
> >     Gtk::MessageDialog  dialog(*mp_window, "Errore", false,
> > Gtk::MESSAGE_ERROR);
> >     dialog.set_secondary_text(display_msg);
> >     dialog.run();
> >     dialog.hide();
> > }
> 

Then I replied

> But dialog.run() makes sense only for a *modal* dialog. 
> I want my dialogs to be *modeless*, and I want them to be destroyed 
> when the user closes or deletes them.
> 
> Actually, my GtkMM application is a probe providing the GUI interface 
> interacting with the GCC compiler (suitably extended by MELT, 
> see http://gcc-melt.org/ for more)
> 
> my dialogs are giving (lazily) a lot of information on every relevant 
> control location for a given GCC compilation 
> 
> I want them to be destroyed (not simply hidden) when the user closes them (and to be created when a 
> user click on a button anchored inside a Gtk Source View buffer for the source 
> code compiled by GCC), because each such dialog carries a lot of luggage.


Then, Povietkin Kostiantyn suggested
> 
> Don`t you think to fire an event closing window?

But I am not sure to understand what that means exactly.

> Then any "manager" object can delete it.


Qt has QObject::deleteLater() for that exact purpose
http://qt-project.org/doc/qt-4.8/qobject.html#deleteLater

but I am not sure of what would be the equivalent in GtkMM.

Regards
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


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