DelphiFAQ Home Search:

Add a page to a tabbed notebook (TTabbedNotebook)


comments4 comments. Current rating: 4 stars (3 votes). Leave comments and/ or rate it.

This example shows you how to create a page and add it to a TTabbedNotebook at runtime and how to add controls to it. The code originates from Graham Mainwaring.

procedure AddPage;
  btnNew : TButton;
  NewPage: TTabPage;
  wNumber: Word;
begin { AddPage }
  // Create the new TTabPage object
  NewPage := TTabPage.Create(Application); 

  // The page must be a child of the notebook

  // Add text to the notebook's Pages property. This will cause
  // the new page to be added as the last tab on the notebook
  wNumber := TabbedNotebook1.Pages.Add('New Page'); 
  TabbedNotebook1.PagesObjects[wNumber] := NewPage; 

  // The page needs controls on it; here's how to add one
  btnNew := TButton.Create(Self); 

  with btnNew do 
    Top := 10; 
    Height := 30; 
    Width := 100; 
    Caption := 'OK'
  end; { with btnNew } 
end; { AddPage } 
You don't like the formatting? Check out SourceCoder then!


2008-09-30, 04:10:56
anonymous from Iran  
2009-11-21, 01:09:05
anonymous from United States  
TabbedNotebook1.PagesObjects[wNumber] := NewPage;
Should Be
TabbedNotebook1.Pages.Objects[wNumber] := NewPage;
2012-09-20, 06:22:08
xtxzhc <a href=' '>viagra</a> >:-OOO <a href=' '>cialis</a> >:]]
2013-02-18, 00:23:41
lgfhfil <a href=' '>order viagra online</a> hVVhNK <a href=' '>order quality cialis</a> 8]]]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: