Subject Re: [IBO] error code -204
Author Geoff Worboys
René,

> Thing is.... I can't duplicate this on a regular form. The
> form I am having probs with is the only one in the whole
> project designed to use embedded forms.

If this is anything like the trouble I had using database stored form
definitions, then I suspect the problem you have is related to how
Delphi streams form definitions. I will try to explain the problems I
had, and you can tell me whether your problem may be related...

I have a base form that is defined in the executable, with various
components etc. I then have some database form definitions that are
supposed to load over-top of this base (they are inherited from that
base).

I am using Dream Company's designer components, but they did not want
to store only the "inherited" aspect, they wanted to store the entire
form definition. I discovered the reason why they did this...

When you create the base form, Delphi loads it from the executable
resource and is no longer in the correct state to load another layer
of inheritance over top of this definition.

There are three ways around this (that I know of)...

1. Store the full form definition (not inherited) and create the
instances from TForm and not from your base. (I did not like this, as
it did not let me have true inheritance operation.)

2. Write your own form constructor that allows you define the stream
to load the additional layer and load this layer at the correct time
in the form construction.

3. Write your base form as a no-resource derivation of
TCustomForm/TForm and register this new base using
RegisterCustomModule (like writing a component). In this way there is
no conflict in the streaming because there is nothing to stream from
the base. The embedded forms are stored as "object" not as
"inherited", they simply have additional properties that will be
stored in the "object" definition.


I have an option 2 solution that I could share. However it does
"borrow" some code from the Dream Company library. I am not sure how
proprietry that code is, since it is very similar to the code in
Classes.pas - it just has a few refinements, specifically to detect
binary/text object streams.

Alternatively, if you look at the streaming done in TCustomForm you
can probably work much of it out for yourself.

HTH

Geoff Worboys
Telesis Computing