473,511 Members | 11,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnMouseUp behaving strangely

I have an event handler in a subclass of TreeView:

protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
this.contextMenu.Show(this, new System.Drawing.Point(e.X, e.Y));
base.OnMouseUp(e);
}

When I right click, the menu pops up. If I left click somewhere outside the
menu, the menu disappears, but thereafter every LEFT click causes the event
to be fired again with e.Button == System.Windows.Forms.MouseButtons.RIGHT.

It works correctly in the list view.

Any suggestions as to what could be causing this and how to fix it?

Thanks,
Aaron Queenan.
Nov 15 '05 #1
2 1730
If the first left click is over an item, the problem occurs. If the first
left click is over the control background, the problem doesn't occur.

"Aaron Queenan" <aq*********************@contingent.com.au> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have an event handler in a subclass of TreeView:

protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e) {
if (e.Button == System.Windows.Forms.MouseButtons.Right)
this.contextMenu.Show(this, new System.Drawing.Point(e.X, e.Y)); base.OnMouseUp(e);
}

When I right click, the menu pops up. If I left click somewhere outside the menu, the menu disappears, but thereafter every LEFT click causes the event to be fired again with e.Button == System.Windows.Forms.MouseButtons.RIGHT.
It works correctly in the list view.

Any suggestions as to what could be causing this and how to fix it?

Thanks,
Aaron Queenan.

Nov 15 '05 #2
Sorry, I should have said (if the first left click is over an item's
CHECKBOX). The treeview and listview I am using both have checkboxes
visible.

Thanks,
Aaron.

"Aaron Queenan" <aq*********************@contingent.com.au> wrote in message
news:ea**************@TK2MSFTNGP10.phx.gbl...
If the first left click is over an item, the problem occurs. If the first
left click is over the control background, the problem doesn't occur.

"Aaron Queenan" <aq*********************@contingent.com.au> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
I have an event handler in a subclass of TreeView:

protected override void
OnMouseUp(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
this.contextMenu.Show(this, new System.Drawing.Point(e.X,

e.Y));
base.OnMouseUp(e);
}

When I right click, the menu pops up. If I left click somewhere outside

the
menu, the menu disappears, but thereafter every LEFT click causes the

event
to be fired again with e.Button ==

System.Windows.Forms.MouseButtons.RIGHT.

It works correctly in the list view.

Any suggestions as to what could be causing this and how to fix it?

Thanks,
Aaron Queenan.


Nov 15 '05 #3

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

Similar topics

1
6077
by: John Smith | last post by:
In the code snippet below, I tried to allow the user to choose a page to view by selecting an item from a dropdown list. I could make it work on Mozilla and related browsers, but I couldn't make it...
1
2449
by: coolsti | last post by:
I am trying to let the user drag a rectangle over an image, which will then let the user zoom in on the dragged area. However, I am doing something wrong in implementing the onmousedown and...
3
1644
by: Scott | last post by:
I have a derived DataGrid class that overrides the OnMouseUp event so that I can highlight multiple cells for cut/copy/paste functionality. When the user selects to open a new file via a...
2
5767
by: David Wake | last post by:
I am a complete Javscript newbie trying to produce a user interface similar to Google Maps -- the user should be able to click anywhere on the map and drag it in any direction. The Javascript...
9
7572
by: jon | last post by:
Hello, I'm trying to experiment with some javascript to do some custom dragdrop handling. I wish to use the onMouseDown event to trigger the start of my drag, and onMouseup for a potentential...
2
4413
by: sujitksharma | last post by:
Hi, Following is a simple html which has a table with one "<tr>" and two "<td>". Both the "<td>"s have a fixed width of "150px". In one "<td>" I have put some long text, while in the second "<td>"...
1
3774
by: NeilCarmichael | last post by:
I am flummoxed, I'm relatively new to javascript and I can't get my onmousedown onmouseup script to work. simply, I want to fire one function when I click down on a graphic and a second when I...
11
3410
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/onmouseup.html In Firefox, if I click in the black box and then release, I get a popup. If I click, drag the cursor, and then release, I don't....
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7089
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
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.