How to pass an array to a property?

0

I am trying to pass an array of Strings and two arrays from TAlignment to three properties (published). But I'm having the following error (which is the same for all three properties):

  

[dcc32 Error] uCad.pas (31): E2188 Published property 'ColumnTitleName' can not be of type ARRAY ".

The code is below:

type
    TCad = class
    private
      FColumnTitleName: array of String;
      FColumnTitleAlign: array of TAlignment;
      FColumnAlign: array of TAlignment;
      function GetColumnAlign(index: Integer): TAlignment;
      function GetColumnTitleAlign(index: Integer): TAlignment;
      function GetColumnTitleName(index: Integer): String;
    public

    published
      property ColumnTitleName[index: Integer]: String read GetColumnTitleName;
      property ColumnTitleAlign[index: Integer]: TAlignment read GetColumnTitleAlign;
      property ColumnAlign[index: Integer]: TAlignment read GetColumnAlign;
  end;

implementation

function TCad.GetColumnAlign(index: Integer): TAlignment;
begin
  Result := FColumnAlign[index];
end;

function TCad.GetColumnTitleAlign(index: Integer): TAlignment;
begin
  Result := FColumnTitleAlign[index];
end;

function TCad.GetColumnTitleName(index: Integer): String;
begin
  Result := FColumnTitleName[index];
end;

end.

Does anyone know where I'm going wrong?

Thank you.

    
asked by anonymous 07.02.2018 / 21:40

1 answer

0

It seems like a problem like this

Delphi _How to pass data to a record array property

You may also have to declare a type for this array. Sometimes you can not use the array of [something] directly.

    
09.02.2018 / 11:02