开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜