Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TShellTreeView

Status
Not open for further replies.

Len

MIS
Sep 13, 1999
1
0
0
US
I'm trying to drag a node from one shelltree view to another. in the drop shelltreeview i want the root to be the dragged node of the first shelltreeview. phisical drive locations work fine but virtual folders don't. ie... stv1.Root:=stv2.path;
but if path is somthing like "Recycle Bin" it won't work. How to do this?
 
I got it to work like this:
const //string version of trootfolder in ShellCtrls.pas
TRootFolders :array[1..23] of string = ('rfDesktop', 'rfMyComputer', 'rfNetwork', 'rfRecycleBin', 'rfAppData',
'rfCommonDesktopDirectory', 'rfCommonPrograms', 'rfCommonStartMenu', 'rfCommonStartup',
'rfControlPanel', 'rfDesktopDirectory', 'rfFavorites', 'rfFonts', 'rfInternet', 'rfPersonal',
'rfPrinters', 'rfPrintHood', 'rfPrograms', 'rfRecent', 'rfSendTo', 'rfStartMenu', 'rfStartup',
'rfTemplates');

//tv1 and tv2 are tshelltreeview objects
//no error checking!
//tv1 shows folders only
//tv2 shows folders and and nonfolders

procedure TForm1.tv22DragDrop(Sender, Source: TObject; X, Y: Integer);
var
d:integer;
begin
d:=1;
tv2.Items.BeginUpdate;
if not fileexists(tv1.Path) then
begin
repeat
tv2.root:=trootfolders[d];
inc(d);
until tv1.path=tv2.path;
end
else
tv2.Root:=tv2.path;
tv2.Items.EndUpdate;
end;
 
oops
fileexists should be directoryexists
and
after else should be
tv2.Root:=tv1.path;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top