ideintf: simplify component treeview get caption method

git-svn-id: trunk@22917 -
This commit is contained in:
paul 2009-12-02 03:34:16 +00:00
parent aa612b4fd3
commit fc82b28dc7

View File

@ -601,16 +601,6 @@ end;
function TComponentTreeView.CreateNodeCaption(APersistent: TPersistent): string;
function GetItemIndex(AItem: TCollectionItem): Integer;
var
i: integer;
begin
for i := 0 to AItem.Collection.Count - 1 do
if AItem.Collection.Items[i] = AItem then
Exit(i);
Result := -1;
end;
function GetCollectionName(ACollection: TCollection): String;
var
PropList: PPropList;
@ -644,9 +634,7 @@ begin
Result := GetCollectionName(TCollection(APersistent)) + ': ' + Result
else
if APersistent is TCollectionItem then
begin
Result := IntToStr(GetItemIndex(TCollectionItem(APersistent))) + ' - ' + TCollectionItem(APersistent).DisplayName;
end;
Result := IntToStr(TCollectionItem(APersistent).Index) + ' - ' + TCollectionItem(APersistent).DisplayName;
end;
initialization