2009-06-24 133 views

回答

6

您需要将DeleteEventArgs.RetVal设置为true,而不是false。从relevant Mono documentation

为了保持Gtk.Window从封闭,设置Gtk.DeleteEventHandlerGtk.DeleteEventArgs.RetValtrue

+0

谢谢!它不是很清楚...... – Pisu 2012-05-20 12:48:23

0

从快速谷歌搜索发现,这条巨蟒的例子(link):

# 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 

希望这有助于。

+1

将DeleteEventArgs.RetVal设置为false可防止应用程序退出,但窗口仍然消失,并调用ShowAll不会再显示它。 – weiqure 2009-06-26 18:35:24