PC Review


Reply
Thread Tools Rate Thread

Context menu popup on treeview node returning wrong selected node

 
 
Claire
Guest
Posts: n/a
 
      5th Mar 2007
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)


 
Reply With Quote
 
 
 
 
TheSteph
Guest
Posts: n/a
 
      5th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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)
>
>



 
Reply With Quote
 
Claire
Guest
Posts: n/a
 
      5th Mar 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Treeview : Adding a node to a specific existing node with Net 1.0(work with 2.0) michelqa@yahoo.ca Microsoft C# .NET 2 12th Jun 2008 08:18 AM
Popup Menu for a treeview node TexKiernan Microsoft Access VBA Modules 1 20th Feb 2008 03:48 PM
wrong TreeView node selected rfm Microsoft ASP .NET 2 24th Jan 2007 12:43 PM
How to get the selected node of TreeView when context menu popup? =?Utf-8?B?TmljaXlvdQ==?= Microsoft Dot NET Framework Forms 3 30th Mar 2005 08:12 AM
Treeview Node Loses highlight when context menu opens Phill Microsoft C# .NET 4 8th Nov 2004 02:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:28 PM.