[Gtk-sharp-list] FileChooserDialog Problem

Darryl Pentz darryl.pentz at attix5.com
Fri Oct 7 08:53:39 EDT 2005


Just implemented my own dialog, and now I at least get an exception of (as
expected really) System.NullReferenceException. Just FYI.

It's happening deep down in GLib as indicated at the end of my previous
post.

I'm using Gtk 2.6 with latest C# source from svn.

- DP

> -----Original Message-----
> From: gtk-sharp-list-bounces at lists.ximian.com
> [mailto:gtk-sharp-list-bounces at lists.ximian.com]On Behalf Of Darryl
> Pentz
> Sent: 07 October 2005 14:37
> To: Gtk-sharp-list at lists.ximian.com
> Subject: [Gtk-sharp-list] FileChooserDialog Problem
>
>
> Is there a known problem with FileChooserDialog. I can't get it to work
> though I'm following how it's used in MonoDevelop and in various Google
> hits. The code I use is as follows:
>
>             FileChooserDialog chooser = new FileChooserDialog("Select a
> file", null, FileChooserAction.Open,
>                                                               Stock.Open,
> ResponseType.Ok, Stock.Cancel, ResponseType.Cancel);
>             try {
>                 ResponseType choice = (ResponseType) chooser.Run();
>                 if (choice == ResponseType.Ok) {
>                     DialogUtils.ShowInfoDialog((Gtk.Window) this.Toplevel,
> "You selected " + chooser.Filename);
>                 }
>             } catch (Exception e) {
>                 DialogUtils.ShowErrorDialog(null, e.Message);
>             }
>             finally {
>                 chooser.Destroy();
>             }
>
> It keeps throwing an exception which I determine to be:
> Inner Exception: {} <-- the debugger doesn't indicate the type or even
> provide an exception object to introspect
>
> StackTrace
>    at GLib.Marshaller.FilenamePtrToString(IntPtr ptr)
>    at GLib.Marshaller.FilenamePtrToStringGFree(IntPtr ptr)
>    at Gtk.FileChooserDialog.get_Filename()
>
> I'm not sure if this is a known problem or if I'm doing something wrong.
> Above, where I indicate 'null', I've also used the dialog that is
> the parent
> to the button that initiates the opening of the FileChooserDialog, so that
> isn't the problem.
>
> Any help would be appreciated.
>
> Should I just write my own dialog using FileChooserWidget? I
> guess I'll try
> that regardless, in the meantime.
>
> thanks,
> Darryl Pentz
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list



More information about the Gtk-sharp-list mailing list