I am trying to get a popup to show when the mouse enter a button.
It should then hide if the user leaves the popup.
But for a good user experience, the popup should also stay open if the user goes back on the button.
So when the mouse gets out of the popup, the mouse leave event is triggered, but I don’t want to handle it if the mouse entered the button at the same moment.
Is there any way of knowing if the mouse is over another control in the mouse leave event?
I have tried many different approach without success. Tell me if you have a different approach to the problem too!
Set a timer when the
MouseLeaveevent on your popup is fired, along with a boolean, perhaps calledclosingPopup, totrue. The timer will setclosingPopuptofalseand hide the popup. On the MouseEnter event of the button, if closingPopup is true, then stop the timer and set the boolean to false.That or a variant of that should get you what you want. You can give it a 1/4 second delay that way. Or any amount that seems responsive.
Edit: You should probably also add the same check to
MouseLeavefor the button. (Glad I could help!)