See attached diff.
Would that be a viable approach?

Bart
Index: /devel/lazarus/lcl/shellctrls.pas
===================================================================
--- /devel/lazarus/lcl/shellctrls.pas	(revision 40594)
+++ /devel/lazarus/lcl/shellctrls.pas	(working copy)
@@ -337,6 +337,8 @@
 end;
 
 procedure TCustomShellTreeView.SetRoot(const AValue: string);
+var
+  RootNode: TTreeNode;
 begin
   if FRoot=AValue then exit;
   FRoot:=AValue;
@@ -344,7 +346,13 @@
   if FRoot = '' then
     PopulateWithBaseFiles()
   else
-    PopulateTreeNodeWithFiles(nil, AValue);
+  begin
+    RootNode := Items.AddChild(nil, FRoot);
+    RootNode.HasChildren := True;
+    //PopulateTreeNodeWithFiles(RootNode, AValue);
+    //writeln('RootNode.Count = ',RootNode.Count);
+    RootNode.Expand(False);
+  end;
   if Assigned(ShellListView) then
     ShellListView.Root := FRoot;
 end;
@@ -600,7 +608,6 @@
   Files := TStringList.Create;
   try
     GetFilesInDir(ANodePath, AllFilesMask, FObjectTypes, Files, FFileSortType);
-
     Result := Files.Count > 0;
 
     for i := 0 to Files.Count - 1 do
@@ -631,7 +638,6 @@
 begin
   // avoids crashes in the IDE by not populating during design
   if (csDesigning in ComponentState) then Exit;
-
   r := GetLogicalDriveStrings(SizeOf(Drives), Drives);
   if r = 0 then Exit;
   if r > SizeOf(Drives) then Exit;
@@ -688,7 +694,8 @@
       Result := IncludeTrailingPathDelimiter(ANode.Text) + Result;
     end;
   end;
-  Result := GetRootPath() + Result;    // Include root directory
+  if not FilenameIsAbsolute(Result) then
+    Result := GetRootPath() + Result;    // Include root directory
 end;
 
 function TCustomShellTreeView.GetSelectedNodePath: string;
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to