FMX.AddressBook.TCustomAddressBook.AllGroups
Delphi
procedure AllGroups(var AGroups: TAddressBookGroups); overload;
procedure AllGroups(const ASource: TAddressBookSource; var AGroups: TAddressBookGroups); overload;
C++
void __fastcall AllGroups(TAddressBookGroups* &AGroups)/* overload */;
void __fastcall AllGroups(TAddressBookSource* const ASource, TAddressBookGroups* &AGroups)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FMX.AddressBook.pas FMX.AddressBook.hpp |
FMX.AddressBook | TCustomAddressBook |
Description
Returns a list of all groups of contacts from the specified source in a device Address Book.
Use this method to get a list of all groups of contacts defined in the specified source in a device Address Book, if any.
Examples
To clarify, consider the following examples. These code snippets illustrate how to fetch all groups from the specified source in a device Address Book.
Note: Before calling the AllGroups method, you should explicitly initialize an instance of the
AGroups
object using the TAdressBookGroups.Create method (for Delphi) or new (for C++Builder).
Delphi:
var
NumberofGroups: Integer;
Groups : TAddressBookGroups;
ComboBox1: TComboBox;
Begin
// Define a combo box that contains a list of all groups from the specified source in a device Address Book.
procedure TForm1.FillComboboxGroups(Source: TAddressBookSource);
var i: Integer;
begin
Groups := TAddressBookGroups.Create;
try
AddressBook1.AllGroups(Groups);
ComboBox1.BeginUpdate;
ComboBox1.Clear;
for i := 0 to Groups.Count -1 do
ComboBox1.Items.Add(Groups.Items[i].Name);
finally
ComboBox1.EndUpdate;
Groups.Free;
end;
end.
C++Builder:
{
TAddressBookGroups *Groups;
TComboBox *ComboBox1;
// Define a combo box that contains a list of all groups from the specified source in a device Address Book.
void __fastcall TForm1::FillComboboxGroups(TAddressBookSource *Source) {
int i;
Groups = new TAddressBookGroups();
__try{
ComboBox1->BeginUpdate();
ComboBox1->Clear();
AddressBook1->AllGroups(Source, Groups);
for (i = 0; i < Groups->Count; i++) {
ComboBox1->Items->Add(Groups->Items[i]->Name);
}
}
__finally{
Groups->Free();
ComboBox1->EndUpdate();
}
}
For more information and samples, see Mobile Tutorial: Using an Address Book Component (iOS and Android).