Changing places on items in treeview!

  • Thread starter Lars Grøtteland
  • Start date
L

Lars Grøtteland

Hello!

During drag&drop of items in a CTreeView - how do I replace items on the
tree which I drag an item on top of.

We can use the example of WindowsXP. In the start menu -> Programs ->
Startup. I can change places on items in that folder. How can I do that in
the treeview? Anyone know?
 
S

Simon Trew

Use TreeView_SelectItem for the drop source and TreeView_SelectDropTarget
for the drop target. You may also want the "track select" style turned on
and use TreeView_CreateDragImage for the source item.

Use TreeView_GetItem, then TreeView_DeleteItem and TreeView_InsertItem to
move it. (Using TreeView_GetItem with all the flags set should get you as
much information as you need to re-insert the item without losing
information.)

This still won't quite be like the menus (it will select an item rather than
show an insertion point between items) but it's probably as near as you are
going to get with a tree.

See "CTreeCtrl, drag and drop operations" in MSDN for more information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top