mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 03:00:24 +02:00
ideintf: simplify component treeview get caption method
git-svn-id: trunk@22917 -
This commit is contained in:
parent
aa612b4fd3
commit
fc82b28dc7
@ -601,16 +601,6 @@ end;
|
|||||||
|
|
||||||
function TComponentTreeView.CreateNodeCaption(APersistent: TPersistent): string;
|
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;
|
function GetCollectionName(ACollection: TCollection): String;
|
||||||
var
|
var
|
||||||
PropList: PPropList;
|
PropList: PPropList;
|
||||||
@ -644,9 +634,7 @@ begin
|
|||||||
Result := GetCollectionName(TCollection(APersistent)) + ': ' + Result
|
Result := GetCollectionName(TCollection(APersistent)) + ': ' + Result
|
||||||
else
|
else
|
||||||
if APersistent is TCollectionItem then
|
if APersistent is TCollectionItem then
|
||||||
begin
|
Result := IntToStr(TCollectionItem(APersistent).Index) + ' - ' + TCollectionItem(APersistent).DisplayName;
|
||||||
Result := IntToStr(GetItemIndex(TCollectionItem(APersistent))) + ' - ' + TCollectionItem(APersistent).DisplayName;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Loading…
Reference in New Issue
Block a user