• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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