Ja, hier der Ausschnitt:
Code:
procedure TMyObject.Assign(Source: TPersistent);
begin
if Source is TMyObject then
begin
FId := TMyObject (Source).FId;
end
else
inherited; //raises an
exception
end;
procedure TMyObject.SetID(aValue: string);
begin
if FID <> aValue then
begin
FID := aValue;
Changed(false);
end;
end;
procedure TMyData.Notify(Item: TCollectionItem;
Action: TCollectionNotification);
begin
inherited;
TMyComp(Owner).Updated;
end;
procedure TMyData.Update(Item: TCollectionItem);
begin
inherited;
TMyComp(Owner).Updated;
end;
Ach ja und mein Property-Editor-Formular zum Ändern der Collection sieht so aus:
Code:
procedure TMyForm.FormShow(Sender: TObject);
if MyData <> nil then
begin
for i := 0 to MyData.Count -1 do
begin
myObject:= MyData.Items[i];
lbx.AddItem(myObject.ClassName,myObject);
end;
end;
end;
procedure TMyForm.btnSaveClick(Sender: TObject);
var myObject: TMyObject;
begin
myObject := (lbx.Items.Objects[0] as TMyObject);
myObject .ID := '1234';
end;