473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Right click tree node

Can I find out which node was right clicked on a treeview?
Jul 20 '06 #1
6 1898
Use the HitTest method to get the node that was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Can I find out which node was right clicked on a treeview?

Jul 20 '06 #2
What I want to do is:
1) Attach a contextstrip menu to treeview
2) Right click a node and pop up the menu
3) If the node has specific text or tag value, then enable or disable some
menu items.

"Kevin Spencer" <uc*@ftc.govwrote in message
news:O%*****************@TK2MSFTNGP04.phx.gbl...
Use the HitTest method to get the node that was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Can I find out which node was right clicked on a treeview?


Jul 20 '06 #3
Are you saying by calling the HitTest when I right click the node ?

"Kevin Spencer" <uc*@ftc.govwrote in message
news:O%*****************@TK2MSFTNGP04.phx.gbl...
Use the HitTest method to get the node that was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Can I find out which node was right clicked on a treeview?


Jul 24 '06 #4
Yes, of course. You call the HitTest method of the TreeView.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:u4*************@TK2MSFTNGP04.phx.gbl...
Are you saying by calling the HitTest when I right click the node ?

"Kevin Spencer" <uc*@ftc.govwrote in message
news:O%*****************@TK2MSFTNGP04.phx.gbl...
>Use the HitTest method to get the node that was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Can I find out which node was right clicked on a treeview?



Jul 24 '06 #5
Should I call this hittest method when the mouse is right clicked ?

"Kevin Spencer" <uc*@ftc.govwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Yes, of course. You call the HitTest method of the TreeView.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:u4*************@TK2MSFTNGP04.phx.gbl...
>Are you saying by calling the HitTest when I right click the node ?

"Kevin Spencer" <uc*@ftc.govwrote in message
news:O%*****************@TK2MSFTNGP04.phx.gbl.. .
>>Use the HitTest method to get the node that was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl.. .
Can I find out which node was right clicked on a treeview?



Jul 25 '06 #6
This isn't rocket science. You want to know which node was clicked. So, you
want to handle the Click event of the TreeView Control. The only time you
can handle this event is when the mouse is clicked. The MouseEventArgs
passed to the event will tell you the coordinates of the mouse. You then use
those coordinates with the HitTest or the GetNodeAt method, passing those
coordinates to the method, to obtain a reference to the node that was
clicked.

See:
http://msdn2.microsoft.com/en-us/lib....treeview.aspx

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Sequence, Selection, Iteration.
"Alan T" <al*************@yahoo.com.auwrote in message
news:OQ**************@TK2MSFTNGP02.phx.gbl...
Should I call this hittest method when the mouse is right clicked ?

"Kevin Spencer" <uc*@ftc.govwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Yes, of course. You call the HitTest method of the TreeView.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:u4*************@TK2MSFTNGP04.phx.gbl...
>>Are you saying by calling the HitTest when I right click the node ?

"Kevin Spencer" <uc*@ftc.govwrote in message
news:O%*****************@TK2MSFTNGP04.phx.gbl. ..
Use the HitTest method to get the node that was clicked.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl. ..
Can I find out which node was right clicked on a treeview?
>




Jul 25 '06 #7

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

Similar topics

3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
0
by: adbarnet | last post by:
Hi, A second question... In my treeview control, I would like to offer the user the ability to right click on a tree-node, and depending on the type of node clicked provide them either a list...
3
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...
4
by: Remi Hugnon | last post by:
Hi, I want to build an expandable treeview. I saw some code on VB but I know only C# I plan for my class that each nodes has its own id (using span for example). Into a single aspx page...
1
by: Patrick | last post by:
This may be a simple question but how can I make the tree change the selected node... on a right click .. in addition to the left click? What I want is to filter my context menu based on the type...
1
by: MrNobody | last post by:
by default when you right click a tree the control selects the node if you add a right-click event (so that I can put sepearate ContextMenus depending on what type of node the user clicked on)...
3
by: sugee | last post by:
hi, I have a treeview when rightclicked a context menu should appear. but first time wen i right click the context menu of that node(ie, add,delete) appears whereas when i right click another...
4
by: Smokey Grindel | last post by:
Is there any way to be able to right click a tree node and make sure that the selected node is the one you right clicked? Right now I can select a node then right click a different node and the...
0
by: tarun | last post by:
Hello All, Please find the code for a simple wx.TreeCtrl code. Whenever I right click on any item in the Tree, I see the function, 'OnSelChanged' gets called twice. What I've just done is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.