<Type Name="MessageDialog" FullName="Gtk.MessageDialog"> <TypeSignature Language="C#" Value="public class MessageDialog : Gtk.Dialog, Implementor, IWrapper, IDisposable" Maintainer="John Luke" /> <AssemblyInfo> <AssemblyName>gtk-sharp</AssemblyName> <AssemblyPublicKey> </AssemblyPublicKey> <AssemblyVersion>0.0.0.0</AssemblyVersion> <AssemblyCulture>neutral</AssemblyCulture> <Attributes /> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement> <Docs> <summary>Convenient message window</summary> <remarks> <para> <see cref="T:Gtk.MessageDialog" /> presents a <see cref="T:Gtk.Dialog" /> with an image representing the <see cref="T:Gtk.MessageType" /> (Error, Question, etc.) alongside some message text. It is available as a convenience. You could construct the equivalent of <see cref="T:Gtk.MessageDialog" /> from <see cref="T:Gtk.Dialog" /> without too much effort, but <see cref="T:Gtk.MessageDialog" /> saves typing. </para> <para> The <see cref="T:Gtk.MessageDialog" /> is displayed using <see cref="M:Gtk.Dialog.Run()" />, which automatically makes the <see cref="T:Gtk.MessageDialog" /> modal and waits for the user to respond to it. <see cref="M:Gtk.Dialog.Run()" /> returns when any <see cref="T:Gtk.Button" /> in the <see cref="T:Gtk.Dialog" /> is clicked or the <see cref="T:Gtk.MessageDialog" /> is closed. </para> <para> After <see cref="M:Gtk.Dialog.Run()" /> returns, you are responsible for hiding (using <see cref="M:Gtk.Widget.Hide()" />) or destroying (using <see cref="M:Gtk.Widget.Destroy()" />) the dialog if you wish to do so.</para> <para> A simple message dialog <example> <code lang="C#"> MessageDialog md = new MessageDialog (parent_window, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Error loading file"); int result = md.Run (); md.Destroy(); </code> </example></para> <para> A yes/no message dialog <example> <code lang="C#"> MessageDialog md = new MessageDialog (parent_window, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "Are you sure you want to quit?"); ResponseType result = (ResponseType)md.Run (); if (result == ResponseType.Yes) Application.Quit(); else md.Destroy(); </code> </example></para> <para> If you would like the <see cref="T:Gtk.MessageDialog" /> to not be modal, set the property <see cref="P:Gtk.Dialog.Modal" /> to <see langword="false" />. <example> <code language="C#"> md.Modal = false; </code> </example></para> </remarks> </Docs> <Base> <BaseTypeName>Gtk.Dialog</BaseTypeName> </Base> <Interfaces> <Interface> <InterfaceName>Atk.Implementor</InterfaceName> </Interface> <Interface> <InterfaceName>GLib.IWrapper</InterfaceName> </Interface> <Interface> <InterfaceName>GLib.IWrapper</InterfaceName> </Interface> <Interface> <InterfaceName>System.IDisposable</InterfaceName> </Interface> </Interfaces> <Attributes /> <Members> <Member MemberName="Finalize"> <MemberSignature Language="C#" Value="protected override void Finalize ();" /> <MemberType>Method</MemberType> <ReturnValue> <ReturnType>System.Void</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>Disposes the resources associated with the object.</summary> <remarks /> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public MessageDialog (IntPtr raw);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="raw" Type="System.IntPtr" /> </Parameters> <Docs> <summary>Internal constructor</summary> <param name="raw">Pointer to the C object.</param> <returns>An instance of <see cref="T:Gtk.MessageDialog" />, wrapping the C object.</returns> <remarks> <para>This is an internal constructor, and should not be used by user code.</para> </remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public MessageDialog (Gtk.Window parent_window, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType bt, string msg);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="parent_window" Type="Gtk.Window" /> <Parameter Name="flags" Type="Gtk.DialogFlags" /> <Parameter Name="type" Type="Gtk.MessageType" /> <Parameter Name="bt" Type="Gtk.ButtonsType" /> <Parameter Name="msg" Type="System.String" /> </Parameters> <Docs> <summary>Creates an instance of <see cref="T:Gtk.MessageDialog" /></summary> <param name="parent_window">an object of type <see cref="T:Gtk.Window" /></param> <param name="flags">an object of type <see cref="T:Gtk.DialogFlags" /></param> <param name="type">an object of type <see cref="T:Gtk.MessageType" /></param> <param name="bt">an object of type <see cref="T:Gtk.ButtonsType" /></param> <param name="msg">an object of type <see cref="T:System.String" /></param> <returns>an object of type <see cref="T:Gtk.MessageDialog" /></returns> <remarks> <para> Creates an instance of <see cref="T:Gtk.MessageDialog" /><example> <code lang="C#"> MessageDialog md = new MessageDialog (parent_window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Close, "Error loading file"); </code> </example></para> </remarks> </Docs> </Member> <Member MemberName="MessageType"> <MemberSignature Language="C#" Value="public Gtk.MessageType MessageType { get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>Gtk.MessageType</ReturnType> </ReturnValue> <Docs> <summary>The <see cref="T:Gtk.MessageType" /> of the <see cref="T:Gtk.Dialog" /></summary> <returns>an object of type <see cref="T:Gtk.MessageDialog" /></returns> <remarks>The <see cref="T:Gtk.MessageType" /> of the <see cref="T:Gtk.Dialog" /></remarks> </Docs> </Member> <Member MemberName="GType"> <MemberSignature Language="C#" Value="public static GLib.GType GType { get; };" /> <MemberType>Property</MemberType> <ReturnValue> <ReturnType>GLib.GType</ReturnType> </ReturnValue> <Parameters /> <Docs> <summary>GType Property.</summary> <returns>a <see cref="T:GLib.GType" /></returns> <remarks>Returns the native <see cref="T:GLib.GType" /> value for <see cref="T:Gtk.MessageDialog" />.</remarks> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected MessageDialog (GLib.GType gtype);" /> <MemberType>Constructor</MemberType> <ReturnValue /> <Parameters> <Parameter Name="gtype" Type="GLib.GType" /> </Parameters> <Docs> <summary>Protected Constructor.</summary> <param name="gtype">a <see cref="T:GLib.GType" /></param> <returns>a <see cref="T:Gtk.MessageDialog" /></returns> <remarks>Chain to this constructor if you have manually registered a native <see cref="T:GLib.GType" /> value for your subclass.</remarks> </Docs> </Member> </Members> </Type>