开发者

How retrive full path with file name or folder name from ShellTreeView/ShellListView

开发者 https://www.devze.com 2022-12-24 09:30 出处:网络
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 (li

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号