Magical Property- Insert properties into another component

1

I'm working with flowpanel on Delphi and I noticed that it adds an additional property in objectInspector , control index , to objects inserted in it.

I wanted to know how this is done, if I ever needed the feature, how would a component change the properties of another object without being inherited?

    
asked by anonymous 14.04.2016 / 19:45

1 answer

1

I can not guarantee that it will be what it does, but to add strings and methods to other components without inheritance, just use ClassHelpers (more information on this link )

  

Note: It adds more properties and methods, but Fields can not be created.

unit StreamHelper;

type
  TStreamHelper = class helper for TStream
  private
    function GetAsByteArray: TByteArray;
    procedure SetAsByteArray(const Value: TByteArray);
  public
    property AsByteArray: Integer read GetAsByteArray write SetAsByteArray;
  end;
    
26.04.2016 / 17:00