techno
techno

Reputation: 6500

Overriding GTK Window Close Event to Show a Message

I'm trying to override the Gtk.Window close event so that a Dialog is displayed to the user if a certain Boolean value is set.Inspite the Boolean Value being true my application Quits without showing the Dialog.I have tried printing out the Boolean value.It is correct.

protected void OnDeleteEvent (object sender, DeleteEventArgs a)
    {
            Console.WriteLine (bval);
            if (bval == true) { 

                mynot notification=new mynot(this); 
                notification.Show (); 

            }
            else
            {
                Gtk.Application.Quit ();
                a.RetVal = true;
            }
    }

Upvotes: 0

Views: 1145

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14587

The signal handler return value should be true in the if-case (to stop the default handler from being invoked). In the else-case you should probably just return false to allow default handler to run and not call Quit() yourself.

Upvotes: 1

Related Questions