- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Get a count and list all the controls on a TNoteBook

Question:

How can I get a count and list all the controls on a TNoteBook component?

Answer:

The following example demonstrates getting a list of the pages in

a TNotebook component, and listing the controls on each page of the

Notebook component. The list is added into a Listbox component.



Example:



procedure TForm1.Button1Click(Sender: TObject);

var

  n: integer;

  p: integer;

begin

  ListBox1.Clear;

  with Notebook1 do begin

    for n := 0 to ControlCount - 1 do begin

      with TPage(Controls[n]) do begin

        ListBox1.Items.Add('Notebook Page: ' +

                           TPage(Notebook1.Controls[n]).Caption);

        for p := 0 to ControlCount - 1 do

          ListBox1.Items.Add(Controls[p].Name);

        ListBox1.Items.Add(EmptyStr);

      end;

    end;

  end;

end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile