xamarin / urho

Code to integrate with the Urho3D engine
Other
462 stars 122 forks source link

UIElement and Text mouse hover problem #381

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi, i can't run HoverBegin, HoverEnd delegates. How can i use control events. I added to elements to UI.Root and their see. But my mouse event don't invoke...

For example:

public class UIElementFoo : UIElement {
public UIElementFoo() {
/*My child elements*/
    HoverBegin += new Action<HoverBeginEventArgs>((e) => { Console.WriteLine("Hover begin"); });
    HoverEnd += new Action<HoverEndEventArgs>((e) => { Console.WriteLine("Hover end"); });
}
}
barefists commented 5 years ago

Works if I write this

public class UIElementFoo : UIElement {
    public UIElementFoo() {
    /*My child elements*/
        HoverBegin += (HoverBeginEventArgs) => { Console.WriteLine("Hover begin"); };
        HoverEnd += (HoverEndEventArgs) => { Console.WriteLine("Hover end"); };
    }
}
ghost commented 5 years ago

I think events work directly added child to UI.Root elements.

UI.Root -Window A (Work) --Window A Childs (Not work) -Window B (Work) --Window B Childs (Not work)

My UI Structure:

public class WindowA : Window {

public WindowA()
{
    AddChild(ElementA());
   AddChild(ElementB());
}
}

UI.Root.AddChild(WindowA); Event just run with WindowA. Bu Childs doesn't invoke.