[Gtk-sharp-list] Notebook question

John Luke jluke@users.sourceforge.net
Sun, 06 Jun 2004 18:27:31 -0400


On Mon, 2004-06-07 at 00:22 +0200, Miguel wrote:
> On Mon, 2004-06-07 at 00:00, John Luke wrote:
> > On Sun, 2004-06-06 at 23:58 +0200, Miguel wrote:
> > > On Sun, 2004-06-06 at 23:37, John Luke wrote:
> > > > On Sun, 2004-06-06 at 23:24 +0200, Miguel wrote:
> > > > > Hi,
> > > > > 
> > > > > is it possible to get a notebook page in the foreground by calling a
> > > > > method, instead of clicking the Register?
> > > > > 
> > > > > 
> > > > 
> > > > nb.CurrentPage = pageNum; 
> > > 
> > > If I do that, I get the following Exception:
> > > Unhandled Exception: System.NullReferenceException: Object reference not
> > > set to an instance of an object
> > > in <0x00027> MoreWidgets_Glade:on_button1_clicked
> > > (object,System.EventArgs)
> > > 
> > > nb is instanciated from a glade file.
> > > 
> > > Is there anything more to do?
> > 
> > You have an error somewhere, can you paste the on_button1_clicked
> > section of that file?
> [Glade.Widget]   
> Button button1;
// need this here also
[Glade.Widget]
> Notebook notebook1;
> .
> .
> .
> void on_button1_clicked(object o, EventArgs args)
> 		{
> 			notebook1.CurrentPage = 1;
> 		}
> 
> For Information: There are three Registers. 

You need [Glade.Widget] for the notebook1 also, otherwise it is null and
causing your error.