FMX.AddressBook.Types.TContactDates.AddDate

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

function AddDate(const AKind: TContactDate.TLabelKind; const ADate: TDate): TContactDate; overload;
function AddDate(const ALabel: string; const ADate: TDate): TContactDate; overload;

C++

TContactDate* __fastcall AddDate(const TContactDate::TLabelKind AKind, const System::TDate ADate)/* overload */;
TContactDate* __fastcall AddDate(const System::UnicodeString ALabel, const System::TDate ADate)/* overload */;

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
function public
FMX.AddressBook.Types.pas
FMX.AddressBook.Types.hpp
FMX.AddressBook.Types TContactDates


Beschreibung

Fügt einer Liste der kontaktbezogenen Daten ein neues Datum hinzu.

Mit dieser Methode fügen Sie der Liste der kontaktbezogenen Daten ein neues Datum hinzu. Mit den Eingabeparametern können Sie die folgenden Charakteristika angeben:

  • ADate: gibt einen Wert des TDate-Typs an, der das kontaktbezogene Datum, wie einen Geburtstag, repräsentiert.
  • AKind: in der ersten übeladenen Methode gibt dieser Parameter die Art des Kontakt-Datums an.
  • Alabel: in der zweiten überladenen Methode gibt dieser Parameter eine optionale Beschriftung, wie "Geburtstag," "Jubiläum," usw. an.

Beispiele

Sehen Sie sich zur Klärung die folgenden Beispiele an. Die Codefragmente zeigen, wie das Datum des Geburtstags der Kontaktperson angegeben wird, und speichert diesen Kontakt im Adressbuch.

Delphi:
var
  Contact: TAddressBookContact;
  Locale: TFormatSettings;
  Dates : TContactDates;
 begin
  Contact := AddressBook1.CreateContact(AddressBook1.DefaultSource);
  try
   // Specify the locale to use
    Locale := TFormatSettings.Create('en-US');
    Dates := TContactDates.Create;
    try
      // Add the birthday of the contact person
      Dates.AddDate(TContactDate.TLabelKind.Birthday,StrToDate('12/17/1990',Locale));
      Contact.Dates := Dates;
    finally
      Dates.Free;
    end;
  // Save the newly created contact
  AddressBook1.SaveContact(Contact);  
  finally
    Contact.Free;
  end;
end;
C++Builder:
        TAddressBookContact *Contact;
	TContactDates *dates;
        // Create a new contact
	Contact = AddressBook1->CreateContact(AddressBook1->DefaultSource());
	__try {
		// Specify the locale to use
		TFormatSettings locale = TFormatSettings::Create("en-US");
		dates = new TContactDates();
		__try {
			// Add the birthday date of the contact person
			dates->AddDate(TContactDate::TLabelKind::Birthday,
				StrToDate("12/17/1990", locale));
			Contact->Dates = dates;
		}
		__finally {
			dates->Free();
		}
		// Save contact to Address Book
		AddressBook1->SaveContact(Contact);
	}
	__finally {
		Contact->Free();
	}

Weitere Informationen und Beispiele finden Sie unter Mobile-Tutorial: Verwenden der Adressbuch-Komponente (iOS und Android).

Siehe auch