[Mono-list] FileChooserDialog
Paulo Augusto
PauloMorfeo at portugalmail.pt
Wed Jan 25 19:06:39 EST 2006
It isn't because of that Suse 10's bug. I confirmed now since i was
testing mono in several platforms and versions.
I tried it in Red Hat 4 with mono 1.1.13 in Gnome, Suse Linux Pro 9.3
with mono something (the original) and with mono 1.1.11 in Kde, and in
Windows with mono 1.1.13. Except with Suse's original mono (where it
complains about not finding a assembly), it always gives the "Object
reference not set to an instance of an object" complaint.
Maybe there's something wrong with that small piece of code?
The executable was created with mono's 1.1.13 compiler in X-Develop in
the Red Hat 4 system.
I was locking forward to try FileChooserDialog since FileSelection looks
old is ugly as sin in the default Red Hat's Gnome (which is also ugly as
sin, by the way) and in Windows...
Seg, 2006-01-16 às 18:25 +0100, Lluis Sanchez escreveu:
> If your distro is Suse 10, it might be due to the following (fixed) bug:
> https://bugzilla.novell.com/show_bug.cgi?id=132309
>
> El sáb, 14-01-2006 a las 17:47 +0000, Paulo Augusto escribió:
> > I am trying to use FileChooserDialog but it is failing me. There isn't
> > much documentation about it and, so, i'm trying an example which is
> > mostly the same as the example of FileSelection which is in the
> > documentation and works fine.
> >
> > /******************************************/
> > using System;
> > using Gtk;
> >
> > namespace Aprendizagem
> > {
> > public class ExemploFileChooserDialog
> > {
> > Label lbl;
> > FileChooserDialog fc;
> >
> > public ExemploFileChooserDialog ()
> > {
> > Application.Init ();
> > Window win = new Window ("FileSelectionSample");
> > win.SetDefaultSize (250,200);
> > win.DeleteEvent += new DeleteEventHandler (Sair);
> > VBox vbox = new VBox (true, 1);
> > win.Add (vbox);
> > Button btn = new Button ("Select a file.");
> > btn.Clicked += new EventHandler (BtnClicked);
> > vbox.Add (btn);
> > lbl = new Label ("Selected: ");
> > vbox.Add (lbl);
> > win.ShowAll ();
> >
> > fc = new FileChooserDialog ("Choose a folder", win,
> > FileChooserAction.SelectFolder, null);
> > fc.Response += new ResponseHandler (OnFileSelectionResponse);
> >
> > Application.Run ();
> > }
> >
> > void BtnClicked (object o, EventArgs args)
> > {
> > fc.Run();
> > fc.Hide();
> > }
> >
> > void OnFileSelectionResponse (object o, ResponseArgs args)
> > {
> > if (args.ResponseId == ResponseType.Ok)
> > {
> > lbl.Text = "Selected: " + fc.Filename + "\n" +
> > "Folder: " + fc.CurrentFolder;
> > }
> > }
> >
> > void Sair (object o, DeleteEventArgs args)
> > {
> > Application.Quit ();
> > }
> > }
> > }
> > /******************************************/
> >
> > When trying to run, the output is this:
> >
> > Unhandled Exception: System.NullReferenceException: Object reference not
> > set to an instance of an object
> > in <0x0019c> Gtk.FileChooserDialog:.ctor (System.String title,
> > Gtk.Window parent, FileChooserAction action, System.Object[]
> > button_data)
> > in <0x0019a> Aprendizagem.ExemploFileChooserDialog:.ctor ()
> > in <0x00016> Aprendizagem.Program:Main (System.String[] args)
> >
> > Anyone could help me out in what's wrong of if it is some bug!?
> > _______________________________________________
> > Mono-list maillist - Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
More information about the Mono-list
mailing list