Board index » delphi » Inherited forms

Inherited forms

Can anyone tell me if all the code of an inherited form is copied to
the program, or does one copy exist to be used by all inherited forms?

 The reason I ask is this: I have a project in which I have to perform
a series of test cases on a particular piece of hardware. Each test
case (75 in all) consists of several sub tests. Most test cases use a
core set of sub tests, with one or more different sub tests added
depending on what the test case needs to accomplish.

 I have a generic form that displays all the common information for
each test case. I want to use it to inherit each test case from,
adding components to the form and overriding one procedure to execute
the code that that particular test case must execute.

 Since I have about 75 test cases, I'm afraid my compiled code may
become grotesquely overweight.

If none of this makes sense, Don't feel bad. I'm as lost as anyone,
and I have to write the darn thing!

 

Re:Inherited forms


Quote
> Can anyone tell me if all the code of an inherited form is copied to
> the program, or does one copy exist to be used by all inherited forms?

First, the meta-answer: Try it and see!

Second, the actual-answer: I used an inherited form for the first time
yesterday. Inherited handlers were copied to the new form object, but
*were* visible to the object inspector. I didn't look at the code with
TDW or anything, but it sure *looks* like there's only one copy of the
code.

--

http://www.midnightbeach.com/jon   Personal Pages
http://www.midnightbeach.com/jon/pubs Programming Publications
http://www.midnightbeach.com/hs             Home School Resource List

Re:Inherited forms


In article <4l3rn1$...@server.cntfl.com>, j...@atom.com says...

Quote

>Can anyone tell me if all the code of an inherited form is copied to
>the program, or does one copy exist to be used by all inherited forms?

To my knowledge there is only one instance of the actual code. When you call do
Inherited CreateXxxxx(Sender), you are actually calling the Ancestor code. If you
can come up with a good way to really minimize the code for each window and
put most on the inherited, you should be able to keep your app reasonably sized,
and not 'Grotesquely overweight'.
--
Brad Mettee
PC HotShots, Inc.
Baltimore, MD
TAFG, STTNG & TOM - Pinball is good for you soul!

Re:Inherited forms


Quote
j...@atom.com (Joe Andrews) wrote:
> I have a generic form that displays all the common information for
>each test case. I want to use it to inherit each test case from,
>adding components to the form and overriding one procedure to execute
>the code that that particular test case must execute.

> Since I have about 75 test cases, I'm afraid my compiled code may
>become grotesquely overweight.

In addition to an inherited form, you should conisder using only 1
form and dynamically creating its components.  Along with an array of
test-specific functions, this may be a better solution.

| Adam Mellis
| Information Arts
| amel...@infoart.com

Other Threads