Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvOutlookList
Programmatically looping through items in the TAdvOutlookList

This code snippet shows how you can programmatically loop through all items and in this case, copy the items structure of the TAdvOutlookList to a TListBox:
uses
  AdvOutlookList, OutlookGroupedList;

procedure TForm1.Button1Click(Sender: TObject);
var
  p,c: poglitem;
  sl: TStrings;
begin
  p := AdvOutlookList1.RootItem.FirstChild;

  while assigned(p) do
  begin
    sl := advoutlooklist1.GetItemData(p);
    if Assigned(sl) and (sl.Count > 0) then
      listbox1.Items.Add(sl.Strings[0]);

    c := p.FirstChild;
    while assigned(c) do
    begin
      sl := advoutlooklist1.GetItemData(c);
      if Assigned(sl) and (sl.Count > 0) then
        listbox1.Items.Add('-'+sl.Strings[0]);
      c := c.NextSibling;
    end;

    p := p.NextSibling;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  advoutlooklist1.TestFill;
end;