[Gtk-sharp-list] Progress Bars

Peter Williams peter@newton.cx
Fri, 05 Dec 2003 11:42:54 -0500


On Fri, 2003-12-05 at 03:23, Pablo Fischer wrote:
>   public BloggyProgress() {
>     //Load the Glade Interface
>     Glade.XML ui = new Glade.XML(null, "bloggyprogress.glade",
> "progressbarwindow", null);
>     //Connect it
>     ui.Autoconnect(this);
>     //Cast the Window
>     progressbarwindow = (Gtk.Window)ui["progressbarwindow"];
>     //And the progressbar
>     progress = (Gtk.ProgressBar)ui["progress"];

One thing here. If you have a variable in your class named
progressbarwindow marked with the Glade.Widget attribute, like this:

	[Glade.Widget] Gtk.Window progressbarwindow;

The Autoconnect function will set that variable to the appropriate
widget. A brilliant time-saver.

>     progress.Fraction = 1;
>     //Show it..
>     progressbarwindow.Show();
>   }
> And fails If I try to use .Fraction, .Pulse or something, well it
> compiles ok, but when I show it (the Progress) bar I get an exception:
> Unhandled Exception: System.NullReferenceException: A null value was
> found where an object instance was required
> THIS only happens if I try to use methods or properties of a
> progressbar.

Are you sure progress isn't null? Maybe the name it has in the glade
file got changed or something.


Peter Williams                          peter@newton.cx

"[Ninjas] are cool; and by cool, I mean totally sweet."
                              -- REAL Ultimate Power