By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,028 Members | 863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,028 IT Pros & Developers. It's quick & easy.

Right click tree node

P: n/a
Can I find out which node was right clicked on a treeview?
Jul 20 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.