FileTreeComponentEx (Delete/Copy/Cut/Rename)


#1

Guys, I’m doing a new FileTreeComponentEx with the option to right-click and open a menu to delete, copy, cut, paste and rename.

So far I could get Delete working without problems.

The only thing is the Rename/Move/Copy part. How can I re-build the file-list? For the delete I just delete the item and sub-items. But for the other options, I need to check how to rename an item, but also copy items, in a way that the file-structure will still work.

I also want to keep the stuff the user opened open, so I don’t want to just re-do the tree-view from start, that would be very annoying while sorting files…

I can share the code once its done, so any advice would be most appreciated.

Wk


#2

Ok, I found a way to open the last renamed item. Its not the best solution, but its still good. :wink:

in the FileListTreeItemEx constructor, I just add this:

[code] if (isDirectory && owner.OpenItem != File::nonexistent)
{
if (owner.OpenItem.isAChildOf(file_))
{
setOpen(true);
}
}

		if (owner.OpenItem == file_) this->setSelected(true,true);

[/code]

OpenItem is a File variable which has the full path of the item you just renamed. So far it seems to be working.

Wk