开发者

Getting the index # of a TCollection Item when added to a TCollection

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: Int开发者_开发百科eger read GetId;  
end;  

function TCVSClassItem.GetId: Integer;  
begin  
 result:=  ????  
end;


result := Index+1 should do it if I understand correctly your needs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜