Board index » delphi » page control tabs question

page control tabs question

I have a PageControl with two tabs.  I want to add two more tabs such
that the third is identical to the first and the fourth is identical
to the second, except that they will be working with different data.
Same component names even (if possible).  Is there a "neat" way to do
this, or is it best to just copy the components from one tab to the
other and give them different names?
 

Re:page control tabs question


Quote
Jan Philips wrote:
> I have a PageControl with two tabs.  I want to add two more tabs such
> that the third is identical to the first and the fourth is identical
> to the second, except that they will be working with different data.
> Same component names even (if possible).   Is there a "neat" way to do
> this, or is it best to just copy the components from one tab to the
> other and give them different names?

If this is at design time, then the simplest, fastest solution is just
to select all the tab sheet's controls and paste them into the new sheet.

If this is at run time, then that technique may still be the easiest if
there aren't very many controls to create.

If you have many controls, then what you can do is put them on a TFrame
instead of directly on the TTabSheet. Then, for your second tab sheet,
just create another instance of your frame on put that on your sheet.

--
Rob

Re:page control tabs question


Shouldn't you use TabControl, rather than PageControl ?

"Jan Philips" <judmccrNOSP...@bellsouth.net> ha scritto nel messaggio
news:mu9h8v0fklq38ff2nqr2bcc030abctoh3u@4ax.com...

Quote
> I have a PageControl with two tabs.  I want to add two more tabs such
> that the third is identical to the first and the fourth is identical
> to the second, except that they will be working with different data.
> Same component names even (if possible).  Is there a "neat" way to do
> this, or is it best to just copy the components from one tab to the
> other and give them different names?

Re:page control tabs question


Actually, it is pretty easy since I almost do what you want to do for
most of my programs.  You will have to purchase another tab component
though.

Create A Tabsheet, make to tabsheets, and change the tabs.visible
property to false.  This will leave the 2 page tab control with no
tabs showing.  Call them sheet1 & sheet2.

Create a TabControl directly above it and create 4 tabs. Place the
tabs directly above the tabsheet so it looks as if they are connected.
 Then simply edit the TabControl's onchange event to change the
tabsheets and to change the data the controls on the sheets.

Good luck.

Quote
Jan Philips <judmccrNOSP...@bellsouth.net> wrote in message <news:mu9h8v0fklq38ff2nqr2bcc030abctoh3u@4ax.com>...
> I have a PageControl with two tabs.  I want to add two more tabs such
> that the third is identical to the first and the fourth is identical
> to the second, except that they will be working with different data.
> Same component names even (if possible).  Is there a "neat" way to do
> this, or is it best to just copy the components from one tab to the
> other and give them different names?

Re:page control tabs question


On Tue, 01 Apr 2003 13:18:48 GMT, "Stark" <starkwed...@virgilio.it>
wrote:

Quote
>Shouldn't you use TabControl, rather than PageControl ?

Perhaps.  I've always used PageControl before since that fit my needs,
but I need to study up on TabControl to see if it will be better for
this.

Re:page control tabs question


On Tue, 01 Apr 2003 02:07:14 -0600, Rob Kennedy <rkenn...@cs.wisc.edu>
wrote:

Quote
>If this is at design time, then the simplest, fastest solution is just
>to select all the tab sheet's controls and paste them into the new sheet.

It is at design time.  I was looking for a different solution, but I
think I'll just do that and change the names of the components.  

Other Threads