[Gtk-sharp-list] How I make a message dialog?

RedHatIsBetter edu.rm.85 at gmail.com
Mon Aug 13 10:41:46 UTC 2012


Hi, I have problema with MessageDialog, I can't run any window message in a
little application I develop.

This is the code of the application (MainWindow.cs).
------------------------------------------------
using System;
using Gtk;
using GtkSharp;
// Poner las librerías del sistema y MySQL
using System.Data;
using MySql.Data.MySqlClient;
//using System.Windows.Forms;

//public partial class MainWindow: Gtk.Window
public partial class frm_clientes: Gtk.Window
{	
	//public MainWindow (): base (Gtk.WindowType.Toplevel)
	public frm_clientes (): base (Gtk.WindowType.Toplevel)
	{
		Build ();
	}
	
	protected void OnDeleteEvent (object sender, DeleteEventArgs a)
	{
		Application.Quit ();
		a.RetVal = true;
	}

	protected void OnCmbAnadirClicked (object sender, System.EventArgs e)
	{
		throw new System.NotImplementedException ();
		
		//MessageDialog md = new MessageDialog
(window,dialogflags,msgType,btnType, Message);
        //md.Title = caption;
        //ResponseType tp = (Gtk.ResponseType)md.Run();       
        //md.Destroy(); 
        //return tp;
		
		MessageDialog md = new MessageDialog
  (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close,
   "some error");
       
md.Run ();
// <-- here, I would like to stop and wait for dialog to be closed
md.Destroy(); 


		
	}
}
------------------------------------------------

More code (Main.cs)
------------------------------------------------
using System;
using Gtk;
using GtkSharp;
// Poner las librerías del sistema y MySQL
using System.Data;
using MySql.Data.MySqlClient;

namespace MiniAplicacion
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Application.Init ();
			frm_clientes win = new frm_clientes ();
			win.Resize(300,300);
			
			win.Show ();
			Application.Run ();


		}
	}
}
---------------------------------------------

This is the window.
http://mono.1490590.n4.nabble.com/file/n4650906/n4cqch.png 

This is the error shows me the application when I click on the bottom.
--------------------------------------------
Marshaling clicked signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to
handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by
the target of an invocation. ---> System.NotImplementedException: The
requested feature is not implemented.
  at frm_clientes.OnCmbAnadirClicked (System.Object sender, System.EventArgs
e) [0x00000] in
/home/edu/Mono/MiniAplicacion/MiniAplicacion/MainWindow.cs:26 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x000d5] in
/home/abuild/rpmbuild/BUILD/mono-2.10.6/mcs/class/corlib/System.Reflection/MonoMethod.cs:226 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x000eb] in
/home/abuild/rpmbuild/BUILD/mono-2.10.6/mcs/class/corlib/System.Reflection/MonoMethod.cs:234 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[]
parameters) [0x00000] in
/home/abuild/rpmbuild/BUILD/mono-2.10.6/mcs/class/corlib/System.Reflection/MethodBase.cs:96 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000bf] in
/home/abuild/rpmbuild/BUILD/mono-2.10.6/mcs/class/corlib/System/Delegate.cs:408 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args)
[0x00018] in
/home/abuild/rpmbuild/BUILD/mono-2.10.6/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in
/home/abuild/rpmbuild/BUILD/mono-2.10.6/mcs/class/corlib/System/Delegate.cs:382 
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs
args) [0x0004f] in
/home/abuild/rpmbuild/BUILD/gtk-sharp-2.12.10/glib/Signal.cs:195 
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x0000c] in
/home/abuild/rpmbuild/BUILD/gtk-sharp-2.12.10/glib/SignalClosure.cs:118 
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr
return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr
invocation_hint, IntPtr marshal_data) [0x00075] in
/home/abuild/rpmbuild/BUILD/gtk-sharp-2.12.10/glib/SignalClosure.cs:146 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e,
Boolean is_terminal) in
/home/abuild/rpmbuild/BUILD/gtk-sharp-2.12.10/glib/ExceptionManager.cs:line
58
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr
return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr
invocation_hint, IntPtr marshal_data) in
/home/abuild/rpmbuild/BUILD/gtk-sharp-2.12.10/glib/SignalClosure.cs:line 173
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run() in
/home/abuild/rpmbuild/BUILD/gtk-sharp-2.12.10/gtk/Application.cs:line 135
   at MiniAplicacion.MainClass.Main(System.String[] args) in
/home/edu/Mono/MiniAplicacion/MiniAplicacion/Main.cs:line 19
---------------------------------------------

I'm very tired of try this. I don't find much documentation about Mono :( .



--
View this message in context: http://mono.1490590.n4.nabble.com/How-I-make-a-message-dialog-tp4650906.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list