[Gtk-sharp-list] Win32-Gtk# Dialog.AddButton Exception

Adam Tauno Williams awilliam at whitemice.org
Tue Oct 11 15:08:33 EDT 2005

I am using Gtk# runtime from
- version to try to run a Gtk# application written on Mono/Linux on a
windows workstation.  The application basically runs except when I attempt to
create a dialog box.  It creates the following exception -

Specified cast is not valid.
   at GLib.ObjectManager.CreateObject(IntPtr raw)
   at GLib.Object.GetObject(IntPtr o, Boolean owned_ref)
   at GLib.Object.GetObject(IntPtr o)
   at Gtk.Dialog.AddButton(String button_text, Int32 response_id)
   at Gtk.Dialog.AddButton(String button_text, ResponseType response)
   at SOAPDemo.NetworkOptions..ctor(String title, Window parent)
   at SOAPDemo.RingMenu.OnOptionsNetwork(Object sender, EventArgs args)

I think the code in question is -
this.Response += new ResponseHandler(OnResponse);
DefaultResponse = Gtk.ResponseType.Cancel;
AddButton("Cancel", Gtk.ResponseType.Cancel);
AddButton("Ok", Gtk.ResponseType.Ok);

This code works without incident on Mono/LINUX (SuSe 9.3)

Is this a known flaw in Gtk# (creating a dialog seems pretty basic

Is there a specific mailling list for Win32-Gtk# questions?

Adam Tauno Williams - http://www.whitemice.org

More information about the Gtk-sharp-list mailing list