Sir, I create a project, where I use ShellTreeView, ShellListView, ListView. Now I drag folder from ShellTreeView and files from ShellListView. Now I want to retrieve file name including full path (like: c:\abc\file.txt) or folder (like C:\abc). For retrieving the path I use a command button and a text box. What will the 开发者_开发百科code?
Dev
you can use the TShellListView.SelectedFolder
and TShellTreeView.Path
properties to retrieve the path and filename selected.
this sample uses the onchange event and assign the path into an EditText.
procedure TForm1.ShellListView1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
begin
Edit2.Text := ShellListView1.SelectedFolder.PathName;
end;
procedure TForm1.ShellTreeView1Change(Sender: TObject; Node: TTreeNode);
begin
Edit1.Text:= ShellTreeView1.Path;
end;
精彩评论