Re: Question about delete_event_impl
- From: rob page <page rob gmail com>
- To: "J. Baltasar Garcia Perez-Schofield" <jbgarcia uvigo es>
- Cc: gtkmm-list gnome org
- Subject: Re: Question about delete_event_impl
- Date: Tue, 24 Jan 2006 17:13:57 +0000
In my one of my programs I have this: (AmyEdit derives from Gtk::Window)
bool AmyEdit::on_delete_event(GdkEventAny* event)
{
if (edittabs->CloseAllTabs())
return false;
return true;
}
If it returns
On 24/01/06, J. Baltasar Garcia Perez-Schofield <jbgarcia uvigo es> wrote:
>
> Hi, there !
>
> I'm using Gtkmm 2.4 for a new project, with the interface classes
> generated by Glade. My problem is that I want to intercept the closing
> event of a window, and I've read that you can simply override the
> following method in your window:
>
> gint delete_event_impl(GdkEventAny *);
>
> So I have my class VentanaPpal inheriting from VentanaPpal_Glade which
> inherits from Gtk::Window as well, and then I introduce the line above
> in the .h file and implement the method in the .cpp file:
>
> gint VentanaPpal::delete_event_impl(GdkEventAny *)
> {
> if ( askYesNo( "Are you sure?" ) )
> {
> if ( getCurrentDocument() != NULL ) {
> saveCurrentDocument();
> }
>
> Gtk::Main::quit();
> return false;
> }
>
> return true;
> }
>
> Not very complex/specialized code. Also, the "exit" menu option signal
> handle calls delete_event_impl() function.
>
> Once the application is running, selecting the "exit" menu option makes
> the application to exit correctly, asking the user whether he or she is
> sure or not. However, if I close the window, it just finishes its
> execution.
>
> The documentation says that when a window is about to be closed, the
> signal handle for delete is called, as well as the delete_event_impl()
> method.
>
> Where's my error ?
>
> I also tried to connect a signal manually, in the constructor of
> VentanaPpal_Glade:
>
> signal_delete_event().connect(SigC::slot(*this,
> &VentanaPpal_glade::on_close), false);
>
> However, it then complains about functors.h not ignoring a void value
> (I suppose it has to do with the template receiving the method pointer).
>
> Regards,
>
> Baltasar
>
>
>
> --
>
> PBC -- J. Baltasar García Perez-Schofield
> jbgarcia en uvigo de es http://webs.uvigo.es/jbgarcia/
> Dep. Informática, Universidad de Vigo, España (Spain)
>
> _______________________________________________
> 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]