Solved

runtime pagecontrol with fixed tabsheets on variable number of runtime created tabsheets

Posted on 2008-10-20
5
464 Views
Last Modified: 2013-11-23
Hi
My app creates a variable number of tabsheets at runtime onto a designtime pagecontrol.  That part work fine.  These tabsheets all have the designtime pagecontrol as parent.

the app needs to create a unique 5 tabsheet pagecontrol on each tabsheet created at runtime.
I am not sure how to assign the created pagecontrols to the parent tabsheet of the first pagecontrol.
The only object on each of the 5 tabsheets is a grid of unique records populated before the pagecontrils are displayed.

Do I need to free all the created tabsheets and pagecontrols manually?



0
Comment
Question by:ajtsoukalas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 22761399
depends how you create them. if you use

whatever.create(soemthing);

then no. if you use

whatever.create(nil);

then, maybe. I say maybe, because you can still add all of them to a TObjectList created with .create(true); and that will take care of freeing them. but that again requires code from you, first to create the object list, then to add everything created with nil to it and finally to destroy the object list.

I would recommend using the first way: create(something).

where something can be any tcomponent or descendant, really. usually you would use the same component which is the parent as well since once the parent dies, there is no sense (usually) for the child to live.
0
 

Author Comment

by:ajtsoukalas
ID: 22761603
Ok,
How does one reference the created tabsheet as the parent in the create method?  I'm not sure exactly how to do that.

AJ
0
 

Author Comment

by:ajtsoukalas
ID: 22761686
Sorry,
Stupid question.

What do I use as the argument for the new pagecontrols and the new tabsheets create method to avoid having to deal with it myself?

I know how to reassign the parent of those objects.
0
 
LVL 28

Accepted Solution

by:
2266180 earned 500 total points
ID: 22761821
let's assume the parent is "blabla" (a component).

you will do:

page:=tpagecontrol.create(blabla);
page.parent:=blabla;
tab1:=ttabsheet.create(page);
tab1.parent:=page;
get it?

I don't know who is the parent of who (maybe it's the late hours here) so I cannot give you specific example for your code, but hopefully you can logically transcribe the "blabla" to your actual code :)
0
 

Author Closing Comment

by:ajtsoukalas
ID: 31507975
ciuly,
I was trying to borrow code from another pagecontrol question and should have realized that I needed to assign the create to a variable in order to use it later.

Thanks
aj


Thanks


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question