Changing the nodes in a TreeView behaves oddly

Answered
0
0

I have a TreeView populated with nodes, with an associated ContextMenu (at the TreeView level – not set on individual nodes).  This works fine.

Now, I want to refresh the tree view with a new set of nodes.

m_treeView.Nodes.Clear();

// Add new nodes…

What I see is that the new nodes now appear on the tree view visual (in the browser), but the old nodes that I Cleared() are also still visible (and active!).

If I change to

m_treeView.Nodes.Clear(true);

Now the old nodes go away as expected, but the ContextMenu is wiped out (all items removed – by the call to TreeViewNodeCollection.Clear(true)).  If I rebuild the ContextMenu and re-attach it to the TreeView, I’ll see the correct visuals, but the context menu no longer works – no menu appears on right-click.  Even if I set the ContextMenu on each node, no menu appears.

What the heck is going on here?  This is in code originally written for WinForms, then ported to VWG, then ported to WiseJ.  Never had a problem with it until now.

  • You must to post comments
Best Answer
1
0

Hi Carl,

Are you perhaps using a version older than 3.1.9?

This issue was fixed in that version (3.1.9), and I have also tried to reproduce using the latest 3.2.2 version and I couldn’t reproduce it!

HTH,
Alaa

  • Carl Daniel
    Looks like I’m on 3.1.8. Let me try the latest – needed to do that anyway!
  • You must to post comments
0
0

Upgrade to 3.2.2 fixed it.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.