2009-06-24 5 views

Répondre

6

Vous devez définir DeleteEventArgs.RetVal à true, non false. De l'relevant Mono documentation:

Pour garder un Gtk.Window de fermeture, définissez Gtk.DeleteEventHandler « s Gtk.DeleteEventArgs.RetVal à true.

+0

merci! ce n'était pas vraiment clair ... – Pisu

0

à cet exemple de python (link) à partir d'une recherche rapide Google:

# When the window is requested to be closed, we need to check if they have 
# unsaved work. We use this callback to prompt the user to save their work 
# before they exit the application. From the "delete-event" signal, we can 
# choose to effectively cancel the close based on the value we return. 
def on_window_delete_event(self, widget, event, data=None): 

    if self.check_for_save(): self.on_save_menu_item_activate(None, None) 
    return False # Propogate event 

Espérons que cela aide.

+1

La définition de DeleteEventArgs.RetVal sur false empêche la fermeture de l'application mais la fenêtre disparaît et l'appel de ShowAll ne l'affiche plus. – weiqure

Questions connexes