How to disable "MouseEnter" - completely

In a PushButton I have:

In MouseDown
If Me.Enabled = False Then
Return False
Return True
End if

In MouseEnter
If Me.Enabled = False Then
End if
Me.MouseCursor = System.Cursors.FingerPointer

In MouseUp
MessageBox(“I’m alive :)”)

Me.Enabled = False

If I disable the button in the IDE everything works as I expect. The button is ghosted, the cursor remains unchanged when I hover over the button and nothing happens when I click the mouse.
But if the button is enabled from the start it works only partially as I expect.
When I mouse over the button the first time the cursor changes and if I click I see a dialog and the button gets ghosted when I close the dialog.
If I now hover over the button again the cursor changes and I don’t expect that.
What am I missing here?

you do not set the MouseCursor back to default

Aaaahhh - so simple. A complete oversight :grinning_face_with_smiling_eyes:

In the MouseExit event
Me.MouseCursor = System.Cursors.StandardPointer

And if the cursor is not the StandardPointer to begin with I can save it as an Property and restore it on exit

Thanks, @MarkusR :blush:

1 Like