[Gtk-sharp-list] DeleteEvent and DestroyEvent

Manuel Alejandro Ceron Estrada ceronman@unicauca.edu.co
Tue, 16 Nov 2004 23:12:55 -0500

Hi All,

This is my first message on the list. I have one questions about Gtk#:

In GTK+ (C language) when the handler of the "delete_event" event 
returns FALSE, then a "destroy" signal is emitted. In Gtk#, the 
DeleteEvent handler returns nothing. I suppose that I must use the 
DeleteEventeArgs's RetVal property, the second argument of the 
DeleteEvente handler, but I have tried and does not work, does not call 
the DestroyEvent handler. Where is the error? How can I emit a 
DestroyEvent signal from the DeleteEvent handler?

I have something like this:

public class MyWindow : Window {
	private static void OnDestroy(object obj, DestroyEventArgs args) {
	private static void OnDelete(object obj, DeleteEventArgs args) {
		args.RetVal = false;

	public MyWindow()	:	base("Hola Mundo") {
		this.DeleteEvent += new DeleteEventHandler(OnDelete);
		this.DestroyEvent += new DestroyEventHandler(OnDestroy);

It is supposed that when I close the window, a "Destroyed" message 
should be writen in the console, but does not do that.