Registriert seit: 23. Dez 2004
Ort: Berlin
161 Beiträge
Delphi 6 Professional
|
Re: TCustomShellTreeView.GetPath vom Linker entfernt
10. Mär 2005, 10:23
Hallo,
ich hab mir mal die entsprechenden Routinen in der ShellCtrls näher angeschaut, konnte aber keinen Hinweis dazu entdecken, warum der Linker das entfernt. Hat jemand eine Idee? Oder wie man das evtl. selbst schreiben könnte, damit es funktioniert?
Delphi-Quellcode:
protected
//....
property Path: string read GetPath write SetPath;
//...
function TCustomShellTreeView.GetPath: String;
begin
if SelectedFolder <> nil then
Result := SelectedFolder.PathName
else
Result := '';
end;
procedure TCustomShellTreeView.SetPath(const Value: string);
var
P: PWideChar;
NewPIDL: PItemIDList;
Flags,
NumChars: LongWord;
begin
NumChars := Length(Value);
Flags := 0;
P := StringToOleStr(Value);
try
OLECheck(DesktopShellFolder.ParseDisplayName(
0,
nil,
P,
NumChars,
NewPIDL,
Flags)
);
FUpdating := True;
SetPathFromID(NewPIDL);
except on EOleSysError do
raise EInvalidPath.CreateFmt(SErrorSettingPath, [Value]);
end;
FUpdating := False;
end;
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;
procedure TCustomShellTreeView.SetPath(const Value: string);
var
P: PWideChar;
NewPIDL: PItemIDList;
Flags,
NumChars: LongWord;
begin
NumChars := Length(Value);
Flags := 0;
P := StringToOleStr(Value);
try
OLECheck(DesktopShellFolder.ParseDisplayName(
0,
nil,
P,
NumChars,
NewPIDL,
Flags)
);
FUpdating := True;
SetPathFromID(NewPIDL);
except on EOleSysError do
raise EInvalidPath.CreateFmt(SErrorSettingPath, [Value]);
end;
FUpdating := False;
end;
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;
Tausend Dank, Gina.
|
|
Zitat
|