2
votes

I have created a Tframe unit with visual and DB controls. I registered the frame as a component using the sprig approach. The TFrame has a few published boolean properties.

Everything works OK, except I have noticed that if I start the IDE and open a project that uses that component, the IDE complains about the "unknown" published properties. And if one looks at the DFM, Delphi has changed the definition for the frame within the form it is embedded in from "object ..." to "inline ...". If I just close the project, without saving, and re-open it, all is good.

It only happens on the first project open.

Any suggestions would be appreciated.

1
You always have to initialize default property values in the constructor. The default clause on a property declaration is only used for generating RTTI used by the DFM streaming system. It does not actually assign the property value, the constructor has to assign a value that matches the property's default declaration.Remy Lebeau
Thanks, I did (eventually) realize that. Any ideas of the auto change of object to inline?TomB
A Frame embedded in a Form at design-time is supposed to be declared as inline, not object. If the IDE is complaining when opening the project, it probably has a bug. Which version of Delphi are you using?Remy Lebeau
Using XE6. But I have registered the frame as a component. And this bad behavior only occurs when the first project I open after starting the IDE contains that frame component.TomB
Probably someone who has trouble understanding your question. I know I do.Jan Doggen

1 Answers

1
votes

The thing here is that registering a TFrame does work, but publishing properties almost always does not. I say "almost always" as i had this kind of issue in the past (Delphi XE2 as far as i remember) and there seems to be a bug in the designer deeply hidden somewhere. Debugging this issue gave me no results back then.

I suggest you simply move the published properties to public and set these properties in source code directly. This is a workaround but it works.