Problem with CEGUIDotNet WindowEventArgs

pedrodbs

16-06-2006 22:48:50

Hi!

I'm currently working on a project using OgreDotNet and CEGUIDotNet extension.

Somewhere in my code I have a situation similar to this one:



public class MyClass
{
protected Hashtable mButtons = new Hashtable();
...

public void MyClass()
{
...

for(int i = 0; i < 10; i++)
{
MyObject object = new MyObject(i);
PushButton button = WindowManager.Instance.CreatePushButton("WindowsLook/Button", "mButton" + i);
button.SubscribeEvents();
button.Clicked += new WindowEventDelegate(button_Clicked);
...

this.mButtons.Add(button, object);
}
}

...

private bool button_Clicked(WindowEventArgs e)
{

PushButton button = e.window as PushButton;
MyObject object = this.mButtons[button] as MyObject;

...

return true;
}
}



So the problem is that the variable "button" at the event handler function is always null. I'm trying to retrieve the PushButton that raised the event when it was clicked through "WindowEventArgs e" (like the "sender" in WindowsForms events), but I can't seem to find a way to do that.

Am I missing something, or does CEGUIDotNet not support this kind of behaviour?

Pedro