type
TTVExpandedEvent =
procedure(Sender: TObject; Node: TTreeNode)
of object;
// Basisklasse zum Laden der Parameter aus der Ini-Datei
// = Basisknoten / Ausgangspunkt aller Knoten
TProjectData =
class(TTreeView)
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
private
FUserOnDeletion: TTVExpandedEvent;
procedure DoDelete(Sender: TObject; Node: TTreeNode);
function GetOnDeletion: TTVExpandedEvent;
procedure SetOnDeletion(Value: TTVExpandedEvent);
procedure TreeFromIni(Tree: TTreeView; INI: TIniFile; Section:
string;
Expand: Boolean);
function SetClassForTreeNode(aTree: TTreeView; aIniRefList: TStringList): boolean;
public
function LoadParamFromINIFile(aFile:
string): boolean;
//function SaveToParamINIFile: boolean;
published
property OnDeletion: TTVExpandedEvent
read GetOnDeletion
write
SetOnDeletion;
end;
implementation
//******************************************************************************
// ****** TProjectData-Klasse *******
//******************************************************************************
constructor TProjectData.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
try
OnDeletion := DoDelete;
except
on E:
Exception do begin
ShowMessage('
Create - ' + classname + '
- ' + E.
Message);
end;
end;
end;
//******************************************************************************
destructor TProjectData.Destroy;
begin
inherited;
end;
//******************************************************************************
procedure TProjectData.DoDelete(Sender: TObject; Node: TTreeNode);
begin
if Assigned(FUserOnDeletion)
then FUserOnDeletion(Self, Node);
if Node.Data <>
nil then begin
//TProjectNode(Node.Data).Destroy;
TProjectNode(Node.Data).Free;
Node.Data :=
nil;
end;
end;
//******************************************************************************
function TProjectData.GetOnDeletion: TTVExpandedEvent;
begin
Result := FUserOnDeletion;
end;
//******************************************************************************
procedure TProjectData.SetOnDeletion(Value: TTVExpandedEvent);
begin
FUserOnDeletion := Value;
end;