473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

MouseUp-Event gets 'lost'

Hi,

I have a child-form in an MDI-Application which seems to loose the MouseUp-Event.
I grid (for navigation-purpose) appears on many of the child-forms and in (I think) only one this issue occurs.

What happens:

Private Sub grdNavigation_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdNavigation.MouseDown
Debug.WriteLine("Down: " & e.Button.ToString)
End Sub

Private Sub grdNavigation_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdNavigation.MouseUp
Debug.WriteLine("Up: " & e.Button.ToString)
End Sub

This simple (to clarify the issue) snippet should output:
Tab - Down: Left
Tab - Up: Left
Tab - Down: Right
Tab - Up: Right
It does so for the left button, but with the right button the event happens only every 2 to 5 times.

I've hooked-up Spy++ and I can see the WM_RBUTTONUP-Message every time I release the R-Button.

I've also tried to comment-out all the code in the child-form (exept the designer-code & the mouse-up/down of course) but that makes no difference.

Any-one any clue where to 'look'.

Thanks,

Michael

PS: Just a note: the form contains a TabControl (Maybe 'another' bug?)

I'm using:
a.. vb.Net 2003 Enterprise Architect Edition
b.. Windows XP SP1a
Nov 20 '05 #1
4 1936
Hi,

What do you mean by the grid?

I can not reproduce the problem.
Here is my reproduce steps.
1. Create a new windowform project
2. Add two forms( one set IsMDIContainer to true)
3. Add a tabcontrol onto the child form and add the datagrid onto the
tabpage( I also tried add the datagird onto the form directly)
4. Add the MouseDown and MouseUp event handler

Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown
Debug.WriteLine("Down: " & e.Button.ToString)
End Sub

Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUp
Debug.WriteLine("Up: " & e.Button.ToString)
End Sub

You may try my reproduce steps to see if the problem persists.

Also can you simplify your code and post it here for me to further
troubleshooting.

I look forward to hearing from you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
I think I have to go back to school (form my english anyway)
"Michael Maes" <mi*****@merlot.com> wrote in message news:eR****************@TK2MSFTNGP11.phx.gbl...
Hi,

I have a child-form in an MDI-Application which seems to loose the MouseUp-Event.
I grid (for navigation-purpose) appears on many of the child-forms and in (I think) only one this issue occurs.
A (data)grid (for navigation-purpose) appears on many of the child-forms (of the MDI-Application) and (I think) only this one (form) has the issue.

What happens:

Private Sub grdNavigation_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdNavigation.MouseDown
Debug.WriteLine("Down: " & e.Button.ToString)
End Sub

Private Sub grdNavigation_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdNavigation.MouseUp
Debug.WriteLine("Up: " & e.Button.ToString)
End Sub

This simple (to clarify the issue) snippet should output:
Tab - Down: Left
Tab - Up: Left
Tab - Down: Right
Tab - Up: Right
It does so for the left button, but with the right button the event happens only every 2 to 5 times.

I've hooked-up Spy++ and I can see the WM_RBUTTONUP-Message every time I release the R-Button.

I've also tried to comment-out all the code in the child-form (exept the designer-code & the mouse-up/down of course) but that makes no difference.

Any-one any clue where to 'look'.

Thanks,

Michael

PS: Just a note: the form contains a TabControl (Maybe 'another' bug?)

I'm using:
a.. vb.Net 2003 Enterprise Architect Edition
b.. Windows XP SP1a
Nov 20 '05 #3
Hi Michael,

I am sorry if I did not ask for information properly. What I mean is what
kind of grid do you use.
Since there is two grid in winform controls (Property Grid and datagrid).
Also I think you perhaps use another grid which is created by others.

Now I have know that the problem persists with a datagrid.
And your senario is as below.
You have a few child forms and the child form have datagrid on the each
child form. One of your form did not work proper with the Right mouse
button down.

Since the problem persists in just one of your childform.
To isolate the problem I think you may try to recreate a childfrom and add
the datagrid onto the form and your codes one function by one functions see
if the problem persists.

If the problem still persists, you may try to inherits the DataGrid and
override its winproc function to see if the WM_RBUTTONDOWN and WM_RBUTTONUP
have been captured by datagrid.

Here is my code you may have a try.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim mg As New MyGrid
Me.Controls.Add(mg)
End Sub
End Class

Public Class MyGrid
Inherits DataGrid
Public Enum MouseMessage As Integer
WM_LBUTTONDOWN = &H201
WM_LBUTTONUP = &H202
WM_RBUTTONDOWN = &H204
WM_RBUTTONUP = &H205
End Enum
Dim mm As MouseMessage
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
mm = m.Msg
If Len(mm.ToString()) > 5 Then
Console.WriteLine(mm.ToString)
End If
MyBase.WndProc(m)
End Sub
End Class
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
Hi Peter,

Seems like I've found the problem.

I've stripped-down the form control by control and located the problem in
the mnuEdit - contextmenu.
It was assigned to the form thus (probably) interfering with the WM.

I'dd realy like to thank you for helping me.

Kind regards,

Michael

PS: Still have to examine the "Configuring a VPN Tunnel through vb.Net"

"Peter Huang" <v-******@online.microsoft.com> wrote in message
news:PZ****************@cpmsftngxa06.phx.gbl...
| Hi Michael,
|
| I am sorry if I did not ask for information properly. What I mean is what
| kind of grid do you use.
| Since there is two grid in winform controls (Property Grid and datagrid).
| Also I think you perhaps use another grid which is created by others.
|
| Now I have know that the problem persists with a datagrid.
| And your senario is as below.
| You have a few child forms and the child form have datagrid on the each
| child form. One of your form did not work proper with the Right mouse
| button down.
|
| Since the problem persists in just one of your childform.
| To isolate the problem I think you may try to recreate a childfrom and add
| the datagrid onto the form and your codes one function by one functions
see
| if the problem persists.
|
| If the problem still persists, you may try to inherits the DataGrid and
| override its winproc function to see if the WM_RBUTTONDOWN and
WM_RBUTTONUP
| have been captured by datagrid.
|
| Here is my code you may have a try.
|
| Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles Button1.Click
| Dim mg As New MyGrid
| Me.Controls.Add(mg)
| End Sub
| End Class
|
| Public Class MyGrid
| Inherits DataGrid
| Public Enum MouseMessage As Integer
| WM_LBUTTONDOWN = &H201
| WM_LBUTTONUP = &H202
| WM_RBUTTONDOWN = &H204
| WM_RBUTTONUP = &H205
| End Enum
| Dim mm As MouseMessage
| Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
| mm = m.Msg
| If Len(mm.ToString()) > 5 Then
| Console.WriteLine(mm.ToString)
| End If
| MyBase.WndProc(m)
| End Sub
| End Class
|
|
| Best regards,
|
| Peter Huang
| Microsoft Online Partner Support
|
| Get Secure! - www.microsoft.com/security
| This posting is provided "AS IS" with no warranties, and confers no
rights.
|
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lkrubner | last post by:
I've got a function, you can see it below, that is being called onmouseup in the textarea on my main form. The idea is to find a selection if possible and store that text in a global variable. I...
2
by: fnsbe | last post by:
Hi everybody, First of all I'm not a java hero but I tried to write my own text editor. Everything works but only when the existing text need to be re-edited the butttons of my editor seem not to...
7
by: Sue & Bill | last post by:
Does a double click action also generate two MouseUp events? If so, what is a good method in my MouseUp event handler to detect that a MouseUp is part of a double click action? Thanks in...
1
by: Nathan Sokalski | last post by:
I want to create a pushbutton-like control on my webform that has an image on it. I used to think that this is what the ImageButton control was, but it seems to me that the ImageButton is nothing...
4
by: Colin McGuire | last post by:
Hi again, thanks everyone for your previous help. But having resolved past problems, I'm moving on to new problems :( This one is a simple winforms application with two buttons, named Button1...
0
by: rob willaar | last post by:
I use the treeview to open a new form but the treeview reclaims focus after MouseUp Any solutions to this problem?
1
by: Udi | last post by:
Hi, I have a user control - A that has a panel that contains a list of a different user control - B. When I'm adding a new B to A, I'm subscribing a handler (which is a method of A) to B.MouseUp....
2
mrdata
by: mrdata | last post by:
Hello all I am trying to send 2 commands to my camera, cmovert and cmovest. cmovert will start continuous movement to the right. cmovest will issue a stop command. I would like to have...
2
by: =?Utf-8?B?TWFyaw==?= | last post by:
Does anyone know where there is some sample code that explains now a user; using the mouse can click on an image on the screen. Capture the image by boxing it in using the mouse and then save it to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.