Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

How to handle the nodemouceclick event and double click event of treeview when the mousedown has implemented.

Thank's in Advance.
Posted
Comments
Mehdi Gholam 26-Sep-11 5:37am    
Please specify, ASP.net, WinForms, WPF, which one?
BillWoodruff 26-Sep-11 6:37am    
As Mehdi comments, we need to know more here. These events do not occur at the same time, so what do you mean when you say: "handle ... at the same time" ?
Member 3827009 27-Sep-11 0:20am    
Hi,

My requirement is need to drag&drop the Treeview from one side to anotherside.
In Node click We need to retrieve the particular node content through service method calling.
In Node Double click event we need to start playing that text in Speech voice through the service method call.
In this senarios I can able to handle Mouse Down and Node Mouse Click but double click is not getting fired.

You may not find these comments an "answer" to your question, but ... I think this is the only way I can be helpful to you, given the limited information you provide.

1. I suggest you create a new WinForms project, put a TreeView on it, and define handlers for the TreeView's:

BeforeSelect, AfterSelect, NodeMouseClick, NodeDoubleMouseClick, Click, DoubleClick, MouseDown, MouseClick, MouseDoubleClick Events.

In those handlers put a simple Console.WriteLine statement printing out the name of the Event. Like this:
C#
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
    Console.WriteLine("treeView1_NodeMouseClick");
}

And then, run the project four times with these actions on your part:

a. slowly mouse click on a TreeView Node and release the Mouse.

b. at a slightly faster rate, do several mouse clicks on the TreeView Node.

c. double-click on the TreeView Node, releasing the Mouse as fast as possible.

d. do a series of double-clicks on a TreeView Node as fast as possible.

After each "run" of the Project, examine the Output window, and consider what you observe.

2. In code where you have DragDrop implemented define similar Event handlers for ALL Events related to DragDrop, like ItemDrag. Run, start a drag but stop the drag before you move outside the boundaries of the TreeView, stop the program, examine the output. Repeat for each possible part of a DragDrop operation.

Why do I suggest you do this: because I believe you will observe behavior that will lead you to change your interaction-design as it is. Once you understand the fundamentals of run-time interaction between Controls and Mouse, and then the DragDrop Events, you will, I believe, be able to make wise choices in your implementation strategy.

good luck, Bill
 
Share this answer
 
Comments
Sandeep Mewara 12-Jul-12 12:22pm    
Comment from a new member:
Hi BillWoodruff,

I have a treeview.I want to add node in selected node.My data is coming from SharePoint custom list.Custom list contains two content type folder.How can I achieve this.Can you provide me the solution.
BillWoodruff 13-Jul-12 0:02am    
This is not the appropriate place for a comment that has no relevance to the answer it comments on, and you are quoting another user's question without quotes and attributing it to the original author, which is quite confusing. Please see my response to Deempy's "answer" below, for an example of how to reply to an OT answer on a QA topic. best, Bill
Hi BillWoodruff,

I have a treeview.I want to add node in selected node.My data is coming from SharePoint custom list.Custom list contains two content type folder.How can I achieve this.Can you provide me the solution.
 
Share this answer
 
Comments
Sandeep Mewara 12-Jul-12 12:23pm    
This is not an answer. Please use 'Have a Question or Comment' link to respond to an answer. It will notify answerer of your comment such that he can come back and reply.
BillWoodruff 13-Jul-12 0:04am    
Hi Deempy, This is not an answer. You should submit this as a new question. Personally, I am not familiar with SharePoint or its "custom list." Try to give as much information in your question as you can. good luck, Bill

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900