Topic: Add/Remove TabSheet

Probably simple, but I can't figure it out.

I know how to change the caption on an existing TabSheet, but I want to remove some TabSheets from an existing Project.

I guess I probably need to be pointed to how you add them also.

Thanks
Alan

Re: Add/Remove TabSheet

Looks like I can highlight in the Structure Tree and just hit the delete button.

How to I add TabSheets?

Alan

Re: Add/Remove TabSheet

Hello asawyer13

To remove a Tabsheet

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.TabSheet2.Free;    // You remove TabSheet 2
end;

This is the basic formula.

Now you have to allow the user to delete the TabSheet of his choice.
A form will allow him to select it and an associated button will do the job.
(TabSheet begins with 1)

JB

Re: Add/Remove TabSheet

Sorry, should have made myself clearer..

I want to remove and add TabSheets in the MVD IDE.. I think I got the remove, just highlight and hit Delete, but not understanding how to Add a tab.

Thanks
Alan

5 (edited by derek 2020-12-03 17:32:32)

Re: Add/Remove TabSheet

Hi Again Alan,
Right click either inside the page control or any tablsheet .  It's called 'new page' (somewhat confusing).
Be careful with the page control object because it's rather easy to think you're on a specific tabsheet when you're actually on the page control and vice versa.  I've deleted the entire page control many a time when I thought I was just deleting a tab sheet!  As Jean suggests (Hi Jean)  in his message, it's probably safer to do your deletions from within the 'Structure' panel (above the 'Object Inspector' panel).
If or when you get more into it, the facility to display or hide tabsheets (depending on whatever criteria you may choose) is quite a nice feature.
Derek

Re: Add/Remove TabSheet

Hello asawyer13

Sorry,I misinterpreted your request, I thought you wanted dot it on RunTime

From MVD IDE, to add a new Tabsheet, you click right inside PageControl component,and you click on New Page.

To remove a Tabsheet :

From the Structure/Control window (above Object Inspector) highlight the TabSheet you want remove and press Delete on your keyboard.

JB

Re: Add/Remove TabSheet

Thanks everyone.
Love my MVD.

Re: Add/Remove TabSheet

Hello Derek, Hello asamyer13

As Derek points out, it's easy to accidentally delete a PageControl when you think you are deleting a TabSheet.
PageControl is a container (A component containing other components). Deleting a container also removes the components placed in that container).
To be sure not to make this type of error, I select the component on which I want to work by clicking on its name in the Structure / Control window

JB