Magical Property- Insert properties into another component

Asked

Viewed 210 times

1

I’m working with flowpanel in the Delphi and I noticed that he adds one more property to the objectInspector, the control index, for objects inserted in it.

I wanted to know how this is done, if I ever needed the resource, how one component changes the properties of another object without being by inheritance?

1 answer

1

I can’t guarantee you that’s what he does, but to add principles and methods to other components without inheritance, just use ClassHelpers (more information on this link)

Obs: It adds more properties and methods, but Fields cannot 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;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.