Executing TsPathDialog with a path already set fails to scroll to that path in the directory structure.
The flaw is in this piece of code:
Code:
try
PathDialogForm.sShellTreeView1.BoundLabel.Caption := Caption;
PathDialogForm.sShellTreeView1.Root := FRoot;
if (s = '') then begin
if PathDialogForm.sShellTreeView1.Items.Count > 0 then
PathDialogForm.sShellTreeView1.Items[0].Selected := True;
end
else begin
PathDialogForm.sShellTreeView1.Path := s;
—>> There should be some statements like
CurItem := {item corresponding to path}
PathDialogForm.sShellTreeView1.Items[CurItem].Selected := True;
PathDialogForm.sShellTreeView1.{Scroll to selected item}
end;
—>>
if PathDialogForm.ShowModal = mrOk then begin
I know the code is not correct, but I'm only giving an idea of what changes are possibly required.
PS. Can somebody explain to me why indenting correctly is totally impossible in code snippets? 🙁