I know that when I add a collection item to a collection, the index is zero-based. I would like to make it one-based and show the value in a property called Id
. Can someone tell me how I can go about this in code?
TCVSClassItem = class(TCollectionItem)
private
fId: Integer;
function GetId: Integer;
public
published
property Id: Integer read GetId;
end;
function TCVSClassItem.GetId: Integer;
begin
result:= ????
end;
result := Index+1 should do it if I understand correctly your needs