473,670 Members | 2,397 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(Syste m.Windows.Forms .MouseEventArgs e)
{
if (e.Button == System.Windows. Forms.MouseButt ons.Right)
this.contextMen u.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.MouseButt ons.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 1738
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************ *********@conti ngent.com.au> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I have an event handler in a subclass of TreeView:

protected override void OnMouseUp(Syste m.Windows.Forms .MouseEventArgs e) {
if (e.Button == System.Windows. Forms.MouseButt ons.Right)
this.contextMen u.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.MouseButt ons.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************ *********@conti ngent.com.au> wrote in message
news:ea******** ******@TK2MSFTN GP10.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************ *********@conti ngent.com.au> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I have an event handler in a subclass of TreeView:

protected override void
OnMouseUp(Syste m.Windows.Forms .MouseEventArgs e)
{
if (e.Button == System.Windows. Forms.MouseButt ons.Right)
this.contextMen u.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.MouseButt ons.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
6086
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 work on Internet Explorer. It *seems* that on IE, when the user highlights an item on a dropdown list and then let go of the mouse button, no onmouseup event is generated. Can somebody tell me what the problem was? <form>
1
2463
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 onmouseup events. Everything is very simple so far. I just defined an onMouseDown event to record the event's x and y locations as the starting point, and an onMouseUp event to record the x and y of the end point, and this function gives me the...
3
1655
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 OpenFileDialog dialog, the OnMouseUp event for the grid is called after the user presses the Open button on the OpenFileDialog dialog. Is there a way to prevent this event from being passed down to the grid level? It should just call the OpenFileDialog...
2
5777
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 works OK when the map is only dragged a few pixels. If the map is dragged any significant distance, however, the cursor changes to a document-like icon (in Firefox 1.5) or a circle with a line through it (in IE 5) and no onMouseUp event is fired on...
9
7592
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 drop. I hope to turn on the onmouseup only in onmousedown. And eventually go one step further and incorporate onmousemove for a true drag workflow. I'm running into a problem however, where after mousedown, mouseup will not fire when I release...
2
4421
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>" I have an input box of type text which is a style width of "98%" and the same long text as in first "<td>". Code: <HTML> <BODY> <TABLE border="1" width="300px"> <TR> <td id="1" width="150px">
1
3788
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 release. I tried different combinations of onmousedown onmouseup and onclick and putting them in div's img's and anchor's but I can't get it to work, any ideas?
11
3453
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. Similarly, if I click and then release outside of the black box, I don't get a popup, and I don't understand why. If I comment out "document.getElemenById("demo").onmousedown = mousedown;", it works. Why would that make a difference?
0
8469
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8592
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7419
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5684
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2800
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 we have to send another system
2
2042
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.