PDA

View Full Version : Reusing components on multiple TPageControl pages



masonwheeler
26-06-2008, 01:41 PM
Would it be possible to reuse the same components on more than one page of a TPageControl somehow? (And no, a TTabControl is not what I'm looking for.)

Mason

cairnswm
26-06-2008, 03:04 PM
When a page becomes active, change the control's parenty to point to the active tab.

Not sure it will work, but thats the theory anyway.

masonwheeler
26-06-2008, 03:34 PM
Ooo! That simple? I'll have to test it out. If that would work, it would really simplify things for me.

On a related note, is it possible to treat separate pages of a TPageControl as individual forms, each with their own unit file? Because a TPageControl with a lot of tabs can require a whole lot of code and a massive form declaration, and I like to keep my units small if possible.

cairnswm
27-06-2008, 05:42 AM
If you made a component for each page inheriting from tpagecontrl then you could. Personally I think this is far too much work :)

Andreaz
27-06-2008, 09:42 AM
On a related note, is it possible to treat separate pages of a TPageControl as individual forms, each with their own unit file? Because a TPageControl with a lot of tabs can require a whole lot of code and a massive form declaration, and I like to keep my units small if possible.

Or put a frame on each page...

masonwheeler
27-06-2008, 06:28 PM
A TFrame turned out to be exactly what I was looking for. Thanks, Andreas! I knew there was a way to do it--I've played around with DeDe enough to know that certain programs were using this trick--but I didn't know how they did it.