473,698 Members | 2,242 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
Jul 21 '05 #1
0 1746

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

Similar topics

1
1198
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
11621
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?
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
1556
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
0
981
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...
3
5320
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
1876
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
5009
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
8676
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...
1
8898
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
8870
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
7734
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 projectplanning, coding, testing, and deploymentwithout 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
6524
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
5860
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();...
0
4370
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3051
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

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.