How to set another class as property of a TComponent's descendant class

41 views Asked by At

I'm defining my first components and I would like they can be configured using a TMyOptions class instance.

TMyCmp = class(TComponent)
protected
  FMyOptions : TMyOptions;
  ...
published
  property MyOptions : TMyOptions read FMyOptions write FMyOptions;
  ...
end;

Each component, in the constructor, creates an instance of TMyOptions that's defined like this example:

TMyOptions = class
protected
   FMyOption1 : boolean;
   FMyOption2 : boolean;
published
   property MyOption1 : boolean read FMyOption1 write FMyOption2;
   property MyOption2 : boolean read FMyOption2 write FMyOption2; 
end;

So, in the object inspector I can see TMyOptions but I can't change values. Could someone tell me which is the right way to achieve my goal? Thanks to everyone.

0

There are 0 answers