473,466 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

tree-view item and context menu

I have a form w/ a treeview on it, and a context menu tied to the
tree-view. I need to know what field on the tree is in blue when the
user does the right click. I thought I could use the treenode.text, but
that always returns the first option on the tree and the option that is
in blue. But, if i do the double-click, the text is the option that is
blue.

How can i get the highlighted option that wasn't double-clicked, but
instead was only right-clicked on?

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
2 1438
On 2008-06-23, Darin <darin_nospam@nospameverwrote:
I have a form w/ a treeview on it, and a context menu tied to the
tree-view. I need to know what field on the tree is in blue when the
user does the right click. I thought I could use the treenode.text, but
that always returns the first option on the tree and the option that is
in blue. But, if i do the double-click, the text is the option that is
blue.

How can i get the highlighted option that wasn't double-clicked, but
instead was only right-clicked on?

Darin

*** Sent via Developersdex http://www.developersdex.com ***
If I understand what your asking then you probably want to handle the context
menus Opening event. I usually do something like:

Sub theContextMenu_Opening (ByVal sender As Object, ByVal e As CancelEventArgs) Handles theContextMenu.Opening
Dim hti As TreeViewHitTestInfo = theTreeView.HitTest (Me.PointToClient (Curosr.Position))
If hti.Node Is Nothing Then
e.Cancel = True
Else
' do stuff with the node
End If
End Sub

HTH
--
Tom Shelton
Jun 27 '08 #2
This is closer, but the cursor position is not always the selected node,
but sometimes nodes 4 or 5 positions away.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #3

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

Similar topics

5
by: pembed2003 | last post by:
Hi, I have a question about how to walk a binary tree. Suppose that I have this binary tree: 8 / \ 5 16 / \ / \ 3 7 9 22 / \ / \ / \
2
by: New | last post by:
Why does this code insert a node into a binary search tree correctly? If I only inserting going by first digit it works properly but when I try inserting going by the whole ip and the port number...
5
by: Mike | last post by:
Why does this code insert a node into a binary search tree correctly? If I only inserting going by first digit it works properly but when I try inserting going by the whole ip and the port number...
2
by: andrew browning | last post by:
gbd says the segmentation fault is being generated in the insert function. //CONSTRUCTOR tree():data(value_type()), left(0), right(0){}; tree(value_type vt, tree* l = 0, tree* r = 0):...
2
by: Kiran | last post by:
Hello all, I am using a tree to display stuff, and it is constantly updated, but what I have noticed is in the lowest level, there is clearly noticable cutoff of the text I place there. The cutoff...
1
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
9
by: raylopez99 | last post by:
What's the best way of implementing a multi-node tree in C++? What I'm trying to do is traverse a tree of possible chess moves given an intial position (at the root of the tree). Since every...
4
by: whitehatmiracle | last post by:
Hello I have written a program for a binary tree. On compiling one has to first chose option 1 and then delete or search. Im having some trouble with the balancing function. It seems to be going...
0
by: mac | last post by:
I found that with memory allocating techniques used nowadays (addresses alignment, eg. on 32bit machines) one can detect loops in a tree structure very fast, without using extra memory. This is due...
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
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...
1
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...
0
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...
0
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 project—planning, coding, testing,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.