-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdtv.pas
75 lines (59 loc) · 1.72 KB
/
dtv.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
unit DTV;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls;
type
{ TDetailledTreeView }
TDetailledTreeView = class(TCustomTreeView)
private
FListView: TCustomListView;
procedure SetListView(AValue: TCustomListView);
protected
procedure DoSelectionChanged; override;
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
procedure UpdateListView; virtual;
public
published
property ListView: TCustomListView read FListView write SetListView;
property OnSelectionChanged;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Nick''s components',[TDetailledTreeView]);
end;
{ TDetailledTreeView }
procedure TDetailledTreeView.SetListView(AValue: TCustomListView);
begin
if FListView = AValue then Exit;
if FListView <> nil then FListView.RemoveFreeNotification(Self);
FListView := AValue;
if AValue <> nil then AValue.FreeNotification(Self);
end;
procedure TDetailledTreeView.DoSelectionChanged;
begin
inherited DoSelectionChanged;
if Assigned(ListView) then UpdateListView
end;
procedure TDetailledTreeView.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
case Operation of
opRemove:
if AComponent <> nil then
if AComponent = FListView then begin
ListView := nil
end;
end;
end;
procedure TDetailledTreeView.UpdateListView;
begin
{ This is called only, if ListView <> nil, to fill the ListView with Items,
being determined by the selected Tree Node. Override this in a descendent or
use the OnSelectionChanged event in the Object Inspector}
end;
end.