We help IT Professionals succeed at work.

Embedded component properties

zebada
zebada asked
on
I have a component which has a published property of type: TXYBounds=class(TPersistent)

The published properties in the TXYBounds class show up correctly in the object inspector but they are not saved to the dfm file. Which means that no matter what I set the properties to in the object inspector at design time, at run time they always revert back to their initial values as set in the constructor.

How should I implement this type of embedded component so that it interacts with the object inspector and saves to the dfm file?
Comment
Watch Question

property XYBound: TXYBounds read FXYBounds write SetXYBounds stored true;

it works for me without this
Commented:
Hi zebada.

Could you show us the declaration of your component and TXYBounds class also?

to Lee Nover: AFAIK, if a property declaration contains no storage specifier, it is always stored. So the 'stored true' can be omitted.

Best regards, Ivo.

Commented:
Are properties of TXYBounds also published?
Best you can do is show us the declarations of TXYBounds and the component.

Author

Commented:
Thanks all for your help,

I found the problem, I had declared the component as
  property XYbounds: TXYBounds read FXYBounds;
I changed it to
  property XYbounds: TXYBounds read FXYBounds write FXYBounds;
and it works fine.

ivobauer, due to your suggestion to check the declaration of my component - I compared it to other components that did work and figured out the solution.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.