0
I am trying to pass an array of Strings and two Talignment arrays to three properties (Published). But I’m having the following mistake (which is the same for the three properties):
[dcc32 Error] uCad.pas(31): E2188 Published Property 'Columntitlename' cannot 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.
Hi Tiago. Thanks for the reply. I had seen this post you mentioned. Unfortunately there is no way to solve, because Delphi does not accept array in properties. I have resolved making properties public instead of Published. Hug.
– BJA
Sorry, can you explain better the difference between your problem and that post? There you have array in properties, or not?
– Tiago Rodrigues
Is it because they are Published right? I’ve learned something hj :p
– Tiago Rodrigues
That’s right. From the time I moved the Property statements that were on Published to public, the above code worked. That is, you cannot place an array in a property in Object Inspector, but you can pass an array to a property by code. []s.
– BJA