• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Add/modify/delete a tab

How to add/delete/modify a tab in a TabbedNotebook, a PageControl or a TabControl at runtime?
0
elbaid
Asked:
elbaid
  • 3
  • 2
1 Solution
 
dwwangCommented:
To add:

Declare a tabsheet object, create it, and set its PageControl property to the pagecontrol component you want to add on.

//declaration
    TabSheet1: TTabSheet;

//implementation
    MyTabSheet1 :=TTabSheet.Create(Self);
    MyTabSheet1.PageControl:=PageControl1;

Then modify it as you usually do,also you can delete it by
free method.


0
 
dwwangCommented:
Sorry, the declaration should be:

MyTabSheet1: TTabSheet;

a small mistake :)
0
 
elbaidAuthor Commented:
thats cool for creating somes new tabs but when I want to delete one, the program deletes the last tab available, so I want to be able to delete the one I want, the first, the third, whatever..
0
 
elbaidAuthor Commented:
so the real problem is: i don't know how to call an object created at runtime.
0
 
dwwangCommented:
Hi, one good method to do this is use an array of tabs,

   TabArray:array [1..N] of ttabsheet;

then you can use
   tabarray[i]:= TTabSheet.Create(Self);

   and tabarray[i].free; etc.


0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now