LCL: TShellListView, TShellTreeView: fixed disconnect

git-svn-id: trunk@21271 -
This commit is contained in:
mattias 2009-08-17 20:26:34 +00:00
parent 20ea2c5116
commit 9770ba86c1

View File

@ -54,6 +54,8 @@ type
{ Other internal methods }
function CanExpand(Node: TTreeNode): Boolean; override;
procedure DoSelectionChanged; override;
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
function PopulateTreeNodeWithFiles(
ANode: TTreeNode; ANodePath: string): Boolean;
@ -146,6 +148,8 @@ type
protected
procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer); override;
procedure PopulateWithRoot;
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -289,7 +293,11 @@ begin
procedure TCustomShellTreeView.SetShellListView(
const Value: TCustomShellListView);
begin
if FShellListView=Value then exit;
if FShellListView<>nil then FShellListView.RemoveFreeNotification(Self);
FShellListView := Value;
if FShellListView<>nil then FShellListView.FreeNotification(Self);
// Update the pair, it will then update itself
// in the setter of this property
@ -316,6 +324,13 @@ begin
end;
end;
procedure TCustomShellTreeView.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if AComponent=FShellListView then FShellListView:=nil;
end;
constructor TCustomShellTreeView.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@ -497,14 +512,16 @@ procedure TCustomShellListView.SetShellTreeView(
begin
if FShellTreeView <> Value then
begin
if FShellTreeView<>nil then FShellTreeView.RemoveFreeNotification(Self);
FShellTreeView := Value;
if FShellTreeView<>nil then FShellTreeView.FreeNotification(Self);
Clear;
if Value <> nil then
begin
FRoot := Value.GetPathFromNode(Value.Selected);
PopulateWithRoot();
PopulateWithRoot;
end;
end;
@ -623,6 +640,13 @@ begin
end;
end;
procedure TCustomShellListView.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if AComponent=FShellTreeView then FShellTreeView:=nil;
end;
function TCustomShellListView.GetPathFromItem(ANode: TListItem): string;
begin
Result := IncludeTrailingPathDelimiter(FRoot) + ANode.Caption;