Jan 12, 2012 at 10:55 PM

I am having trouble using the MouseHovering property on my ButtonControls. I seems to be always false, wherever I put the mouse pointer. Is there some trick to using this property or is it just plain broken?

Jan 13, 2012 at 2:23 AM

It works for me - make sure you don't have something at a higher Z-Order

Jan 13, 2012 at 11:50 AM

I also realized that could be the problem, however, it doesn't seem to be.


                headSlotButton.Text = "hovering";
From debugging I know that the if is reached in every tick when the dialog window is open, however, wherever I put the mouse pointer, the control never reaches the inner block. The MouseHovering property is simply false all the time.

Jan 14, 2012 at 2:08 AM

I think you have to be using the built in input library too - are you? (I'm not sure on this)

Jan 14, 2012 at 2:17 PM

I do have

input = new InputManager(Services, Window.Handle);
in the Innitialize method of the main class, wchich should put the NuclexInput in charge of things, if that's what you mean.

Jan 16, 2012 at 8:39 PM

I have found a solution (or workaround, rather), so I guess I might as well share it for anyone who might encounter similar difficulties.

Basically I just created my own class, that inherited ButtonControl and reimplemented the MouseHovering property, which works as expected.


 public class MyButtonControl : ButtonControl
        new public bool MouseHovering
               RectangleF button = this.GetAbsoluteBounds();
               RectangleF mouse = new RectangleF(Mouse.GetState().X, Mouse.GetState().Y, 0, 0);
               return button.Contains(mouse);