Jump to content
  • Advertisement
Sign in to follow this  
Toolmaker

Using a .NET TreeView in C++, tree not synching...

This topic is 3172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having a weird situation that I can't really solve... I'm currently attempting to write a .NET application that uses our unmanaged C++ COM/ATL DLL for the most of it's work. The DLL we're using contains loads of legacy code that can't be removed easily, and one of the major pains in the ass is that the DLL itself relies on a TreeControl/View to be passed into it. I've managed to replace this with a HANDLE instead of an actual pointer to the tree, and I'm now passing a .NET TreeView into it. And that seems to work partially: I can add new items in the DLL without problems, but the .NET side doesn't update itself. I've narrowed this down to the internal buffering done by the .NET object: It makes a local copy of all the tree items, and then when you access the treeView.Nodes collection, you are in fact looking at the buffered copy, and not what's really in there. The question here is: Is there a way for me to FORCE the .NET tree control to synch itself with the items stored according to the Win32 API? Because that would get me the required results back. If I call CTreeCtrl::AddItem() in my unmanaged code, I get to see an extra line in my control, but the states aren't updated correctly... Toolmaker

Share this post


Link to post
Share on other sites
Advertisement
I believe Update() and Refresh() both do it, although they can cause the control to flicker. You can also set the selected object which causes the same sort of invalidation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!