473,395 Members | 1,696 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,395 software developers and data experts.

Right click on a TreeView

Hi everybody,

I've got a TreeView and when ever I right-click on it, the ContextMenuStrip
should comes up. The problem is the following, if the user didn't left-click
an then right click the node he or she desired, the ContextMenuStrip will
show the options for the node that was left-clicked before. How can I make it
work like explorer does that it doesn't need to be left-clicked and then
right -clicked?

I will appreciate if you can direct me to some information relevant to this
or answer my question.

Thanks,

humble.apprentice
Nov 17 '05 #1
4 7151
You need to detect which node was right-clicked - it could be not the
selected one. TreeView.GetNodeAt can help

HTH
Alex

"humble.apprentice" <hu**************@discussions.microsoft.com> wrote in
message news:A3**********************************@microsof t.com...
Hi everybody,

I've got a TreeView and when ever I right-click on it, the ContextMenuStrip should comes up. The problem is the following, if the user didn't left-click an then right click the node he or she desired, the ContextMenuStrip will
show the options for the node that was left-clicked before. How can I make it work like explorer does that it doesn't need to be left-clicked and then
right -clicked?

I will appreciate if you can direct me to some information relevant to this or answer my question.

Thanks,

humble.apprentice

Nov 17 '05 #2
You need to detect which node was right-clicked - it could be not the
selected one. TreeView.GetNodeAt can help

HTH
Alex

"humble.apprentice" <hu**************@discussions.microsoft.com> wrote in
message news:A3**********************************@microsof t.com...
Hi everybody,

I've got a TreeView and when ever I right-click on it, the ContextMenuStrip should comes up. The problem is the following, if the user didn't left-click an then right click the node he or she desired, the ContextMenuStrip will
show the options for the node that was left-clicked before. How can I make it work like explorer does that it doesn't need to be left-clicked and then
right -clicked?

I will appreciate if you can direct me to some information relevant to this or answer my question.

Thanks,

humble.apprentice

Nov 17 '05 #3
It worked! (at last!). Really appreciate your help AlexS.

Thanks,

humble.apprentice
"AlexS" wrote:
You need to detect which node was right-clicked - it could be not the
selected one. TreeView.GetNodeAt can help

HTH
Alex

"humble.apprentice" <hu**************@discussions.microsoft.com> wrote in
message news:A3**********************************@microsof t.com...
Hi everybody,

I've got a TreeView and when ever I right-click on it, the

ContextMenuStrip
should comes up. The problem is the following, if the user didn't

left-click
an then right click the node he or she desired, the ContextMenuStrip will
show the options for the node that was left-clicked before. How can I make

it
work like explorer does that it doesn't need to be left-clicked and then
right -clicked?

I will appreciate if you can direct me to some information relevant to

this
or answer my question.

Thanks,

humble.apprentice


Nov 17 '05 #4
It worked! (at last!). Really appreciate your help AlexS.

Thanks,

humble.apprentice
"AlexS" wrote:
You need to detect which node was right-clicked - it could be not the
selected one. TreeView.GetNodeAt can help

HTH
Alex

"humble.apprentice" <hu**************@discussions.microsoft.com> wrote in
message news:A3**********************************@microsof t.com...
Hi everybody,

I've got a TreeView and when ever I right-click on it, the

ContextMenuStrip
should comes up. The problem is the following, if the user didn't

left-click
an then right click the node he or she desired, the ContextMenuStrip will
show the options for the node that was left-clicked before. How can I make

it
work like explorer does that it doesn't need to be left-clicked and then
right -clicked?

I will appreciate if you can direct me to some information relevant to

this
or answer my question.

Thanks,

humble.apprentice


Nov 17 '05 #5

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

Similar topics

0
by: Billy Jacobs | last post by:
I have a treeview control in my application. If I right- click a node, it highlights the node but does not set it to be selected. If you move off the control it highlights the previously selected...
1
by: Tim Wallace | last post by:
I have a simple app that I'm building using C# (using Visual C# Express Edition). In it, I open an mdi child window that contains a treeview. I want to display a context menu when the user right...
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...
6
by: J.S. | last post by:
I have a TreeView control in the left panel of a SplitContainer. When I click on various nodes in the TreeView I would like different sets of buttons and textboxes to appear in the right panel. ...
1
by: Juan Romero | last post by:
Hey guys, I have a small problem here.... I have a treeview control. I want to display a popup menu when the user right clicks on a node. This is no problem, and I am able to make the popup come...
2
by: tmaster | last post by:
I can detect a right click on my treeview, but SelectedNode.Index points to the last node that was left-clicked. Is there a way for a right-click event of a treeview to update the...
2
by: garyusenet | last post by:
I could do with something similiar, can you tell me if you think this would work for me, and if there's any advantage in working with controls this way than how I currently am. At the moment...
6
by: Alan T | last post by:
Can I find out which node was right clicked on a treeview?
1
by: johnnypung | last post by:
I have a treeview opening a contextMenuStrip on right click. However the right click would not select the node that it right clicks on. How should I make it so the right click will select the node,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.