Dynamic array as property

From: Clevo (geld1_at_freemail.hu)
Date: 03/28/04


Date: Sun, 28 Mar 2004 20:56:40 +0200

Hello,

I made a class with some normal property and I want to add a dynamic array
to the class. But as a property I can't add the dynamic variable.
How is it possible to access a dynamic array element of a class/oject? I
have the following code, but I can't compile it. Any idea?

uses
    WebInputClass;
type
    TWebTable = class
        private
           wtDbName : String;
           wtDbTable : String;
           wtInputList : array of TWebInput;

        published
            procedure ClearInputList();
            procedure AddToInputList(inputItem : TWebInput);

            property DbName : String read wtDbName write
wtDbName;
            property DbTable : String read wtDbTable write
wtDbTable;
            property InputList : array of TWebInput read wtInputList
write wtInputList;
    end;

implementation

    procedure TWebTable.ClearInputList();
    begin
        SetLength(wtInputList,0);
    end;

    procedure TWebTable.AddToInputList(inputItem : TWebInput);
    begin
       SetLength(wtInputList,Length(wtInputList)+1);
       wtInputList[Length(wtInputList)-1] := inputItem;
    end;
end.