Board index » delphi » Dynamic TabPage

Dynamic TabPage

I have a  Tab page on a PageControl that contains many DataAware component.
Now the user wants to be able of adding (and deleting) as many instance of
this TabPage, allowing him to browse the same DataSet to different records.

Is there an easy way to do this?  How will I manage DataSource and Datasets
creation/destruction and linkage to DbAware component?

--
Frederic Gelinas
Programmeur-Analyste
Si Informatique
www.si.qc.ca

 

Re:Dynamic TabPage


Quote
In article <3b617c7b$1_2@dnews>, Frederic Gelinas wrote:
> I have a  Tab page on a PageControl that contains many DataAware component.
> Now the user wants to be able of adding (and deleting) as many instance of
> this TabPage, allowing him to browse the same DataSet to different records.
> Is there an easy way to do this?  How will I manage DataSource and Datasets
> creation/destruction and linkage to DbAware component?

The best way IMO would be to move all the controls (and any support code they
need) to a frame and then add an instance of the frame to your tabsheet. This
makes it much easier to create more instances in code. But for your users
purpose this would not do what he wants. A dataset can only ever have *one*
current record. So instead of using a pagecontrol use a TTabcontrol. Add the
controls (or the frame) to the tabcontrol. You have only one set of these
controls. When the user selects a different tabsheet you simply change the
current record in the dataset accordingly to display it. A bit like a custom
TDBNavigator. If the user wants to add a new "tabsheet" for a new record you
simply add a new Tab and store the primary key of the record in some manner
associated with the tab.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Other Threads