Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#9

Re: Listboxeinträge mit Objekten löschen

  Alt 22. Aug 2009, 15:21
Zitat von mirage228:
Zeig doch mal den Code, wo das ContactForm aus das Contact-Objekt zugreift.
Danke das wars:
Delphi-Quellcode:
procedure TContactForm.FormShow(Sender: TObject);
begin
  if FCurrentContactIndex > -1 then
  begin
    //Contact := ContactList.Items[FCurrentContactIndex];
    Caption := Format('%s', [Helper.MakeCaption(Contact.Name, Contact.Vorname, Contact.Firma)]);
    if Caption = 'then
      Caption := 'Neuer Kontakt';
    DisplayData(FContact);
    SetTlbState;
  end
  else
  begin
    tlbPrevious.Enabled := False;
    tlbNext.Enabled := False;
  end;
  sgDetails.TabOrder := 0;
end;
Delphi-Quellcode:
procedure TContactForm.DisplayData(Contact: TContact);
begin
  Self.Caption := Format('%s', [Helper.MakeCaption(Contact.Name, Contact.Vorname, Contact.Firma)]);
  sgDetails.Cells[1, 0] := Contact.Name;
  sgDetails.Cells[1, 1] := Contact.Vorname;
  sgDetails.Cells[1, 2] := Contact.Firma;
  sgDetails.Cells[1, 3] := Contact.Strasse;
  sgDetails.Cells[1, 4] := Contact.PLZ;
  sgDetails.Cells[1, 5] := Contact.Ort;
  sgDetails.Cells[1, 6] := Contact.Land;
  sgDetails.Cells[1, 7] := Contact.Telefon1;
  sgDetails.Cells[1, 8] := Contact.Telefon2;
  sgDetails.Cells[1, 9] := Contact.EMail1;
  sgDetails.Cells[1, 10] := Contact.EMail2;
  sgDetails.Cells[1, 11] := Contact.Homepage;
  sgDetails.Cells[1, 12] := Contact.Gebdat;
  memBem.Text := Contact.Bemerkung;
  Statusbar1.SimpleText := 'geändert am: ' + Contact.Modified;

  Modified := False;
end;
Contact ist eine Property der Form und anscheinend hat sie eine höhere Priorität als der übergeben Parameter. Wen nich die Zeile
Contact := ContactList.Items[FCurrentContactIndex]; auskommentiere funktioniert es. Jetzt mus sich nur noch rausfinden wozu die Zeile eigentlich gut war.

Problem hat sich also erledigt. Danke für Tipps.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat