Solved

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

Posted on 2008-10-20
5
450 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:ciuly
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:
ciuly 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now