Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-20
5
Medium Priority
?
469 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
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

963 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