Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Q about ShellTreeView no.2 Posted by DeYo on 16 Jul 2003 at 5:36 AM
If I have path saved in string how can I set TShellTreeView to point to this folder. Example:

procedure Button1Click(Sender: TObject)
var
path: string;
begin
path:='c:\my documents';
ShellTreeView1.???:=path;
end;
Report
Re: Q about ShellTreeView no.2 Posted by injektilo on 16 Jul 2003 at 9:54 AM
shellcontrols were under construction in D6, by steve trefethen from the delphi team, and have alot of errors...i know what to change to make your thing work but i dont know how it inflicts other parts of the code, but anyway, here i go:

open te file ShellCtrls wich contains the code (in Demos), add it to your library path and source path to compile. find the following procedure :

procedure TCustomShellTreeView.SetPathFromID(ID: PItemIDList);
var
  I: Integer;
  Pidls: TList;
  Temp, Node: TTreeNode;
begin
  if FUpdating or (csLoading in ComponentState)
    or ((SelectedFolder <> nil) and SamePIDL(SelectedFolder.AbsoluteID, ID)) then Exit;
  FUpdating := True;
  Items.BeginUpdate;
  try
    Pidls := CreatePIDLList(ID);
    try
      Node := Items[0];
      for I := 0 to Pidls.Count-1 do
      begin
        Temp := FolderExists(Pidls[I], Node);
        if Temp <> nil then
        begin
          Node := Temp;
          Node.Expand(False);
        end;
      end;
      Node := FolderExists(ID, Node);
      Selected := Node;
      if Assigned(Node) then
      begin
        if Assigned(FListView) then
          FListView.TreeUpdate(TShellFolder(Node.Data).AbsoluteID);
        if Assigned(FComboBox) then
          FComboBox.TreeUpdate(TShellFolder(Node.Data).AbsoluteID);
      end;
    finally
      DestroyPIDLList(Pidls);
    end;
  finally
    Items.EndUpdate;
    FUpdating := False;
  end;
end;


whenever you set the ShellView.Path property this procedure is called but the first line contains an error and causes to Exit without an update, so you could comment it out.

to change path with the new code use this:
ShellView1.Path := Edit1.Text






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.