Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#8

Re: Eigene Property - Zur Runtime wieder zurückgesetzt

  Alt 22. Sep 2006, 18:53
So hab das jetzt mit ner BinaryProperty gemacht.. aber wenn ich die Exe starte dann bekomm ich diesen Fehler:

Zitat:
---------------------------
Application Error
---------------------------
Exception EReadError in module Project1.exe at 00017497.

Error reading DPListBox1.Items: Invalid property value.


---------------------------
OK
---------------------------


Meine Lese/Schreibe proceduren:

Delphi-Quellcode:
procedure TDPListBox.ReadMyData(AStream: TStream);
var i: Integer;
    tmp: Integer;
begin
  AStream.Read(tmp,SizeOf(Integer));
  FItems.FCount := tmp;
  SetLength(FItems.FItems,Count);
  for i:= 0 to Count-1 do
  begin
    FItems[i] := TDPListItem.Create(Self);
    AStream.Read(tmp,SizeOf(Integer));
    SetLength(FItems[i].FCaption,tmp);
    AStream.Read(FItems[i].FCaption[1],tmp);

    AStream.Read(FItems[i].FImageIndex,SizeOf(Integer))
  end;
end;
Delphi-Quellcode:
procedure TDPListBox.WriteMyData(AStream: TStream);
var i: Integer;
    tmp: Integer;
begin
  tmp:= Count;
  AStream.Write(tmp,SizeOf(Integer));
  for i:= 0 to Count-1 do
  begin
    tmp := Length(FItems[i].FCaption);
    AStream.Write(tmp,SizeOf(Integer));
    AStream.Write(FItems[i].FCaption[1],tmp);
    AStream.Write(FItems[i].FImageIndex,SizeOf(Integer));
  end;
end;
Und die Define Properties Procedure:

Delphi-Quellcode:
procedure TDPListBox.DefineProperties(Filer: TFiler);
begin
  inherited DefineProperties(Filer);
  Filer.DefineBinaryProperty('Items',ReadMyData, WriteMyData, Count > 0);
end;
Ich bin naah dran aber wie gehts weiter ?^^

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat