зеркало из https://github.com/mono/mail-archives.git
99 строки
3.2 KiB
HTML
99 строки
3.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] Newbie cuestion: delete_event of a window
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:jymdman%40home.se">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="004465.html">
|
|
<LINK REL="Next" HREF="004467.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] Newbie cuestion: delete_event of a window
|
|
</H1>
|
|
<B>Fredrik Nilsson
|
|
</B>
|
|
<A HREF="mailto:jymdman%40home.se"
|
|
TITLE="[Gtk-sharp-list] Newbie cuestion: delete_event of a window">jymdman@home.se
|
|
</A><BR>
|
|
<I>Fri, 16 Jul 2004 19:49:04 +0200</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="004465.html">[Gtk-sharp-list] Newbie cuestion: delete_event of a window
|
|
</A></li>
|
|
<LI> Next message: <A HREF="004467.html">[Gtk-sharp-list] Newbie cuestion: delete_event of a window
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#4466">[ date ]</a>
|
|
<a href="thread.html#4466">[ thread ]</a>
|
|
<a href="subject.html#4466">[ subject ]</a>
|
|
<a href="author.html#4466">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>On fre, 2004-07-16 at 19:35 +0200, Raúl Moratalla wrote:
|
|
><i> Hi everybody:
|
|
</I>><i>
|
|
</I>><i> I'm using the documentation of mono and there is the following example
|
|
</I>><i> of a messagedialog:
|
|
</I>><i>
|
|
</I>><i> MessageDialog md = new MessageDialog (parent_window,
|
|
</I>><i> DialogFlags.DestroyWithParent,
|
|
</I>><i> MessageType.Question,
|
|
</I>><i> ButtonsType.YesNo, "Are you sure you want to quit?");
|
|
</I>><i>
|
|
</I>><i> ResponseType result = (ResponseType)md.Run ();
|
|
</I>><i>
|
|
</I>><i> if (result == ResponseType.Yes)
|
|
</I>><i> Application.Quit();
|
|
</I>><i> else
|
|
</I>><i> md.Destroy();
|
|
</I>><i>
|
|
</I>><i> This code is launched in the signal delete_event of a window but, after
|
|
</I>><i> this the window of the application is deleted. What should I do for
|
|
</I>><i> avoid it?
|
|
</I>><i>
|
|
</I>><i> Best regards,
|
|
</I>><i>
|
|
</I>><i> Raúl
|
|
</I>
|
|
Hi Raúl,
|
|
|
|
You need to set the RetVal property of the eventargs, like this:
|
|
|
|
void on_window_delete_event (object o, DeleteEventArgs args) {
|
|
// Show your dialog here
|
|
|
|
if (result == ResponseType.Yes) {
|
|
Application.Quit();
|
|
args.RetVal = false; // <-- Destroy window
|
|
} else {
|
|
md.Destroy();
|
|
args.RetVal = true; // <-- Don't destroy window
|
|
}
|
|
}
|
|
|
|
/Fredrik
|
|
|
|
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="004465.html">[Gtk-sharp-list] Newbie cuestion: delete_event of a window
|
|
</A></li>
|
|
<LI> Next message: <A HREF="004467.html">[Gtk-sharp-list] Newbie cuestion: delete_event of a window
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#4466">[ date ]</a>
|
|
<a href="thread.html#4466">[ thread ]</a>
|
|
<a href="subject.html#4466">[ subject ]</a>
|
|
<a href="author.html#4466">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|