Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array as a property

Status
Not open for further replies.

goodmanrAy

Programmer
Feb 6, 2002
53
GB
Have a problem writing to an array of records which is a property of an object.


type ArrayRecord = record
A : integer
B : string
C : Real


type SomeObject = class(Tobject)
private
FArray : array of TArrayRecord
function GetItem(index : integer)
procedure SetItem(index : integer; value : TArrayrecord)

public
property Array[index : integer] : TArrayrecord read Getitem write setitem


Function GetItem(Index : integer):TArrayrecord;
begin
result := FArray[index]
end

in my code
somevariable := Array[1].A ;

this works fine

But I don't know how to set a value in Array??
Can anyone help??

i.e.
Array[1].A := 1
 
Use a temp record variable (and set it first, then assign it to the record array property) or write properties (and setter methods) for every variable of your record (eg. setArray_A(Index: Integer; Value_A: Integer)).

Otto
 
Thanks

I think a temp record variable is the one for me

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top