Vielleicht hilft dir etwas Code?
Delphi-Quellcode:
type
TKommentare =
class
private
FList: TStringList;
FOnChange: TNotifyEvent;
function GetKommentar(
index: integer):
string;
procedure SetKommentar(
index: integer; kommentar:
string);
public
constructor Create;
destructor Destroy;
override;
property Kommentar[
index: integer]:
string read GetKommentar
write SetKommentar;
property OnChange: TNotifyEvent
read FOnChange
write FOnChange;
end;
constructor TKommentare.Create;
begin
inherited Create;
FList := TStringList.Create;
end;
destructor TKommentare.Destroy;
begin
FList.Free;
inherited;
end;
function TKommentare.GetKommentar(
index: integer):
string;
begin
if index < FList.Count
then Result := FList[
index]
else raise Exception.CreateFmt('
index [%d] out of bounds', [
index]);
end;
procedure TKommentare.SetKommentar(
index: integer; kommentar:
string);
begin
if index < FList.Count
then begin
FList[
index] := kommentar;
if Assigned(FOnChange)
then
FOnChange(self);
end else
raise Exception.CreateFmt('
index [%d] out of bounds', [
index]);
end;
marabu