I have created an XNA project and am trying to implement the Neoforce Library, but I cannot get the Button.Click
event to fire.
Here's my code:
button = new Button(manager);
button.Init();
this.button.Click += new TomShane.Neoforce.Controls.EventHandler(this.button_Click);
button.Text = "Sign In";
button.Width = 72;
button.Height = 24;
button.Left = (main.ClientWidth / 2) - (button.Width / 2);
button.Top = main.ClientHeight - button.Height - 8;
button.Anchor = Anchors.Bottom;
button.Parent = main;
button.Visible = true;
manager.Add(button);
main.Add(button, true);
My event's code is:
void button_Click(object sender, TomShane.Neoforce.Controls.EventArgs e) {
System.Console.Out.WriteLine("Button Clicked");
}
Everything is displayed fine, however the event will simply not fire.
In the Update method, you must run the manager Update method. Like so:
manager.Update(gameTime);
Thanks to Cyral, for giving me the idea to check for this.