473,732 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView Mouse event behaviour puzzles

Hello everyone,

I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client
application using SQL Server on the server side.

I am looking to implement drag & drop in a TreeView control. The operation
takes place entirely within this single control. There is no need to provide
for interaction with other controls, forms, applications etc. Both the drag
source item (a TreeNode) and the drag target item (another TreeNode) are
within the same TreeView.

I have tried using the ItemDrag/DoDragDrop/DragDrop approach but it isn't
cooperating. The DragDrop event just does not fire. NB: TreeView.AllowD rop =
true. Anyway, I thought I would use the old approach of
MouseDown/MouseMove/MouseUp but that isn't working either.

Even though this question is framed in the context of an attempt to
implement drag & drop, this is not really a question about that process. When
I changed to the MouseDown/MouseMove/MouseUp approach the MouseDown/MouseUp
pair started exhibiting some very strange behaviour.

The MouseDown Event is followed immediately by a MouseUp event even
though the mouse button has not been released.

This code:
///_______________ _______________ _______________ ___________
private void TvwManager_Mous eDown(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
System.Console. WriteLine("Mana ger_MouseDown") ;
}
///_______________ _______________ _______________ _______________ ______
private void TvwManager_Mous eUp(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
System.Console. WriteLine("Mana ger_MouseUp" );
}
///_______________ _______________ _______________ _______________ ______
private void TvwManager_Mous eMove(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
System.Console. WriteLine("Mana ger_MouseMove" );
}

Produces this result:

Manager_MouseMo ve
....
Manager_MouseMo ve
Manager_MouseDo wn
Manager_MouseUp
Manager_MouseMo ve
....
Manager_MouseMo ve
Manager_MouseDo wn
Manager_MouseUp
....

Explained as follows
**cursor enters the control, start receiving MouseMove events
Manager_MouseMo ve
....Numerous MouseMove events occur in succession here
Manager_MouseMo ve
**Left Mouse button pressed and held down
Manager_MouseDo wn <<MouseDown occurs -- just as it should
Manager_MouseUp <<MouseUp follows immediately even though the mouse button
has not been released
Manager_MouseMo ve <<This sequence of MouseMoves occurs while the button is
down
....
**Left button is released but, of course, the MouseMove events keep coming
Manager_MouseMo ve

Manager_MouseDo wn <<Try it again...Sequenc e described above repeats: MouseDown
Manager_MouseUp <<followed immediately by MouseUp
etc...

What is going on here? Has anyone else observed this behaviour?
What's to be done about it?

--
Kia pai tō haere, e hoa mā!
Nā Plumer
Nov 22 '05 #1
0 999

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

Similar topics

0
1750
by: Plumer | last post by:
Hello everyone, I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client application using SQL Server on the server side. I am looking to implement drag & drop in a TreeView control. The operation takes place entirely within this single control. There is no need to provide for interaction with other controls, forms, applications etc. Both the drag source item (a TreeNode) and the drag target item (another TreeNode) are...
1
1202
by: Jacek Jurkowski | last post by:
TreeView Control: If I click using left mouse button on a TreeNode it gets blue and SelectedNodeproperty is Changing - Ok. But if I click on it using right mouse button node is getting blue but SelectedNode propery is not changing. So user think's trat he is on node f.e. 3 cause it's color is blue but program is using SelectedNode f.e. 0 for any acctions ... How to solve/disable this?
3
11627
by: vijaynats | last post by:
I have a treeview with a ContextMenu attached. When i click on a node, AfterSelect fires but does not fire when right clicked (the context menu pops up). (Background: I have loaded a list of disk file names onto the tree and have to open the file thru the contextmenu for editing. It opens the file whose treeview node was selected earlier using a left mouse click). Any solutions?
5
3916
by: rh | last post by:
I created a user control that is made up of a TreeView and a VScrollBar. I set the TreeView.FullRowSelect = True and it works as expected (full row is visible, appears on top of everything else) but only sometimes. Other times it appears behind the parent form and all that is visible is the last few characters of that row. Anyone know what might be causing this and how I can fix it? Thanks.
17
9109
by: Spam Trap | last post by:
I am upgrading from VB6 where I had access to a treeview NodeClick event (see below)... but now VB.NET does not have this any more. Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node) ' VB6 code here. End Sub The VB.NET way seems to be inspect the SelectedNode property within the TreeView's Click event... however this is extreamly buggy, and actually fails under some very simple circumstances, telling me that one node is
5
1559
by: A-PK | last post by:
Hi, I am using treeview as my menu. my menu is like the following + Users & Groups - Users -Groups + Departmenuts - Engineering
3
5327
by: sianan | last post by:
Hi, I want to display a 'hover box' (for want of a better description) when the mouse hovers over a node in a tree view. The box would display detail information for the node. It should be small, something like a tool tip. Does anyone have any idea of how to do this? I would really appreciate
1
1881
by: pooja | last post by:
i need to implement drag and drop in treeview in VB. Kindly help. My treeview contains activities maintained using XML Files. Hopefully, Thanks.
1
5012
by: timnels | last post by:
I have created a muti-select treeview control. Problem is I am now trying to implement drag/drop in the application that uses it. It seems the mouse down and mouse move events fire before the OnBeforeSelect and OnAfterSelect events in the treeview. Since I want to start the drag/drop on the mouse move event, I have no clue that the current node has been selected yet. I tried moving all the code into the mouse down event (which actually...
0
8946
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9447
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9307
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9181
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...
1
6735
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
4550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
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
2721
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.