Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

670 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