Re: Doesnt fully work :(

Posted by RJ on October 08, 2004

In Reply to: Re: Doesnt fully work :( posted by creeek on March 01, 2004

Try This code. It will put the new folder in a rename state and will also change 'New Folder' to 'New Folder (1)' if 'New Folder' already exists.

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  path: String;
begin
  path := IncludeTrailingPathDelimiter(ShellTreeView1.Path);
  i := 0;
  if not(CreateDir(path+'New Folder')) Then
    begin
      i := 1;
      while not(CreateDir(path+'New Folder ('+IntToStr(i)+')')) do
        begin
          i := i + 1;
        end;
    end;
  ShellTreeView1.Refresh(ShellTreeView1.Selected);
  if (i > 0) then
    ShellTreeView1.Path := path+'New Folder ('+IntToStr(i)+')'
  else
    ShellTreeView1.Path := path+'New Folder';
  ShellTreeView1.SetFocus;
  ShellTreeView1.Selected.EditText;
end; 

Find related articles

Search for:  ShellTreeView


Delphi Forum :: Tutorials :: Source code :: Tips