MouseLeave bug never to be fixed! >:(

B

Bob

I completely disagree with MS's decision to make you buy a whole new version
of their product to get a fix to such a basic, glaring, long-standing bug. I
deployed an entire ERP system written in DotNet in 2003, and having
MouseLeave stop firing makes all the mouse-tracking controls in its UI look
absolutely stupid, unprofessional. There is no workaround. Now they're
telling me they're never going to fix it, that I have to buy Whidbey. It's
not acceptable. Not at all.

http://lab.msdn.microsoft.com/produ...edbackid=e4b2cafa-1f54-4216-8bc2-0ad03cc4add0

Bob
 
K

Ken Halter

Bob said:
I completely disagree with MS's decision to make you buy a whole new
version
of their product to get a fix to such a basic, glaring, long-standing bug.
I
deployed an entire ERP system written in DotNet in 2003, and having
MouseLeave stop firing makes all the mouse-tracking controls in its UI
look
absolutely stupid, unprofessional. There is no workaround. Now they're
telling me they're never going to fix it, that I have to buy Whidbey. It's
not acceptable. Not at all.

http://lab.msdn.microsoft.com/produ...edbackid=e4b2cafa-1f54-4216-8bc2-0ad03cc4add0

I agree with you, for the most part. It seems that Beta class software is
all we have to work with these days. MS isn't the only one releasing this
stuff either.

fwiw, in "my" world, as a VB Classic developer, I'd always had to add
MouseEnter/Leave events on my own if I wanted them. So, while you're
probably right that there isn't a work around that'll get the built in
events firing, I find it hard to believe that there's no way to implement
your own. There are dozens of samples that show how to do it in VB Classic.
At least one of those should be able to make it through the "wizard" so you
can use it in B#.
 
B

Bob

Ken Halter said:
I agree with you, for the most part. It seems that Beta class software is
all we have to work with these days. MS isn't the only one releasing this
stuff either.

fwiw, in "my" world, as a VB Classic developer, I'd always had to add
MouseEnter/Leave events on my own if I wanted them. So, while you're
probably right that there isn't a work around that'll get the built in
events firing, I find it hard to believe that there's no way to implement
your own. There are dozens of samples that show how to do it in VB Classic.
At least one of those should be able to make it through the "wizard" so you
can use it in B#.

All the workarounds I thought of were just too ugly to use, would you post a
link or two to any you'd recommend?

Bob
 
C

C-Services Holland b.v.

Bob said:
I completely disagree with MS's decision to make you buy a whole new version
of their product to get a fix to such a basic, glaring, long-standing bug. I
deployed an entire ERP system written in DotNet in 2003, and having
MouseLeave stop firing makes all the mouse-tracking controls in its UI look
absolutely stupid, unprofessional. There is no workaround. Now they're
telling me they're never going to fix it, that I have to buy Whidbey. It's
not acceptable. Not at all.

http://lab.msdn.microsoft.com/produ...edbackid=e4b2cafa-1f54-4216-8bc2-0ad03cc4add0

Bob

As a workaround.. you could capture the mouse as the cursor enters it's
area.. then in the mousemove event check if the cursor moves outside the
boundaries and generate your own event or fire off a sub. If you code it
correctly, you just have to add one line per control you want to handle.
i.e.: addhandler txtText.MouseMove, AddressOff myMouseMove

Rinze van Huizen
 
B

Bob

C-Services Holland b.v. said:
Bob wrote:
As a workaround.. you could capture the mouse as the cursor enters it's
area.. then in the mousemove event check if the cursor moves outside the
boundaries and generate your own event or fire off a sub. If you code it
correctly, you just have to add one line per control you want to handle.
i.e.: addhandler txtText.MouseMove, AddressOff myMouseMove

Rinze van Huizen

MouseMove does not fire for a control when the mouse moves outside of its
boundaries. Perhaps I misunderstand your suggestion?

Bob
 
C

C-Services Holland b.v.

Bob said:
MouseMove does not fire for a control when the mouse moves outside of its
boundaries. Perhaps I misunderstand your suggestion?

Bob

In the handler you write you add something like
\\
Sub myMouseMove(sender as object, e as mouseeventargs)
if not sender.capture then
'capture the mouse if not already doing so
sender.capture=true
endif
if e.x>sender.width or e.x<0 or e.y>sender.height or e.y<0 then
' mouse has moved outside the boundaries of the control
'because of capture you can see the coordinates outside 'the control
sender.capture=false
myMouseLeave() 'fire off your own mouseleave event.
endif
end sub
//

not sure about mouseeventargs to be the correct name, but it's something
to that effect. I use this system for a simple report designer I
recently wrote for one of our applications.

Rinze van Huizen
 
N

Nak

Hi Bob,
I completely disagree with MS's decision to make you buy a whole new
version
of their product to get a fix to such a basic, glaring, long-standing bug.
I
deployed an entire ERP system written in DotNet in 2003, and having
MouseLeave stop firing makes all the mouse-tracking controls in its UI
look
absolutely stupid, unprofessional. There is no workaround. Now they're
telling me they're never going to fix it, that I have to buy Whidbey. It's
not acceptable. Not at all.

I have a solution! After a little messing around I remembered a problem
I had once, as it happens the Show and Hide methods don't work all that
well. Instead just use the Win32 API to show and hide the window!

Private Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Int32,
ByVal hWndInsertAfter As Int32, ByVal x As Int32, ByVal y As Int32, ByVal cx
As Int32, ByVal cy As Int32, ByVal wFlags As Int32) As Int32
Private Const SWP_SHOWWINDOW As Int32 = &H40
Private Const SWP_HIDEWINDOW As Int32 = &H80
Private Const SWP_NOMOVE As Int32 = &H2
Private Const SWP_NOSIZE As Int32 = &H1


'TO SHOW
Call SetWindowPos(frmForm2.Handle.ToInt32, 0, 0, 0, 0, 0, SWP_SHOWWINDOW Or
SWP_NOMOVE Or SWP_NOSIZE)

'TO HIDE
Call SetWindowPos(frmForm2.Handle.ToInt32, 0, 0, 0, 0, 0, SWP_HIDEWINDOW Or
SWP_NOMOVE Or SWP_NOSIZE)

I've tested this on the example of the bug from the MS web site and it
fixes the problem. I hope this helps!

Nick.
 
B

Bob

C-Services Holland b.v. said:
In the handler you write you add something like
\\
Sub myMouseMove(sender as object, e as mouseeventargs)
if not sender.capture then
'capture the mouse if not already doing so
sender.capture=true
endif
if e.x>sender.width or e.x<0 or e.y>sender.height or e.y<0 then
' mouse has moved outside the boundaries of the control
'because of capture you can see the coordinates outside 'the control
sender.capture=false
myMouseLeave() 'fire off your own mouseleave event.
endif
end sub
//

Interesting. I never used capture before.

For those NG readers who will inevitably search for and find this thread's
topic in the next months, here's how I made it work.

Thanks,
Bob

----------

Public Class HighlightPanel
Inherits Panel

Protected Overrides Sub OnMouseMove( _
ByVal e As System.Windows.Forms.MouseEventArgs)
If Not Me.Capture Then Me.Capture = True
Dim IsInControl As Boolean = Me.ClientRectangle.Contains(e.X, e.Y)
If IsInControl Then
If Not _MouseIsInControl Then Me.OnMouseEnter(e)
Else
If Me.Capture Then Me.Capture = False
If _MouseIsInControl Then Me.OnMouseLeave(e)
End If
MyBase.OnMouseMove(e)
End Sub

Private _MouseIsInControl As Boolean
Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
_MouseIsInControl = True
Me.BackColor = Color.Red
MyBase.OnMouseEnter(e)
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
_MouseIsInControl = False
Me.BackColor = SystemColors.Control
MyBase.OnMouseLeave(e)
End Sub

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top