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

Context menu popup on treeview node returning wrong selected node

I've a treeview control containing a root node with several children on a
windows form.
I select a node with a left mouse button click.
I then select one of the other nodes with right mouse click to bring up my
context menu. The Popup event of this enables menu items depending on the
node selected.
The new node highlights, and my context menu pops up but I noticed that the
enabled state of the menu items was incorrect.
Tracing into my treecontextmenu_popup event the tree.selectednode is wrongly
shown to be the old node and not the new one. But the new one is
highlighted.
Has anyone got a solution to this please?

(Hideselection = false. Hottracking = false, drawmode=normal)
Mar 5 '07 #1
2 3703
You have to manually select the node when right-clicking it and before
showing your popmenu; even if this node SEEMS to be already selected by your
right-click.

Steph.
"Claire" <cl****@nospam.comwrote in message
news:OA*************@TK2MSFTNGP03.phx.gbl...
I've a treeview control containing a root node with several children on a
windows form.
I select a node with a left mouse button click.
I then select one of the other nodes with right mouse click to bring up my
context menu. The Popup event of this enables menu items depending on the
node selected.
The new node highlights, and my context menu pops up but I noticed that
the
enabled state of the menu items was incorrect.
Tracing into my treecontextmenu_popup event the tree.selectednode is
wrongly
shown to be the old node and not the new one. But the new one is
highlighted.
Has anyone got a solution to this please?

(Hideselection = false. Hottracking = false, drawmode=normal)


Mar 5 '07 #2
Thanks Steph,
yes I've had to add code in the node onclick event to set the selected node
and it now works as I expected.

"TheSteph" <Th******@NoSpam.comwrote in message
news:eg**************@TK2MSFTNGP04.phx.gbl...
You have to manually select the node when right-clicking it and before
showing your popmenu; even if this node SEEMS to be already selected by
your
right-click.

Steph.


Mar 5 '07 #3

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

Similar topics

0
by: Rory | last post by:
I have an app that populates a treeview from an XML file. I want to create a few different context menus that pop up depending on which node is selected. I can get one context menu to appear when I...
4
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped...
4
by: Phill | last post by:
Here's what I'm doing to make the right context mnue show up based on what node was cliked: private void tvwMenu_MouseUp(object sender, MouseEventArgs e) { //Select Node When Right Clicked &...
5
by: Dean L. Howen | last post by:
Dear friends, Could we determine when context menu should appear?
2
by: Srinivasa Raghavan | last post by:
Hi I am using ASP Tree View Control to display data in hiearchy fashion.I am having a checkbox next to the TreeView Node.When user checks or unchecks the nodes and click a button i am putting...
1
by: Chris Murphy via DotNetMonster.com | last post by:
Hi all, I'm just wondering if any one can help me with this development issue I'm having. I've created a customized treeview control to handle the particular tasks to which I'll be using it. Within...
2
by: Ron M. Newman | last post by:
Hi, Just need a little advice. Id like to build *dynamic* context menus for tree nodes. I'm pretty versed in building context menus and attaching them to tree nodes. My question is, what...
6
by: JJ | last post by:
Question: Which controls to use as menus: ============================= I must be approaching this the wrong way, as it clearly must be possible. I am writing a very basic CMS. At the top of...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.