mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 16:49:28 +02:00
LCL: TTReeView: added FindNodeWithTextPath
git-svn-id: trunk@42720 -
This commit is contained in:
parent
d32498513b
commit
eea2c866ec
lcl
@ -2895,6 +2895,7 @@ type
|
||||
Data: Pointer): TTreeNode;
|
||||
function FindNodeWithData(const NodeData: Pointer): TTreeNode;
|
||||
function FindNodeWithText(const NodeText: string): TTreeNode;
|
||||
function FindNodeWithTextPath(TextPath: string): TTreeNode;
|
||||
function FindTopLvlNode(const NodeText: string): TTreeNode;
|
||||
function GetEnumerator: TTreeNodesEnumerator;
|
||||
function GetFirstNode: TTreeNode;
|
||||
|
@ -2377,6 +2377,29 @@ begin
|
||||
Result := Result.GetNext;
|
||||
end;
|
||||
|
||||
function TTreeNodes.FindNodeWithTextPath(TextPath: string): TTreeNode;
|
||||
var
|
||||
p: SizeInt;
|
||||
CurText: String;
|
||||
begin
|
||||
Result:=nil;
|
||||
repeat
|
||||
p:=System.Pos('/',TextPath);
|
||||
if p>0 then begin
|
||||
CurText:=LeftStr(TextPath,p-1);
|
||||
System.Delete(TextPath,1,p);
|
||||
end else begin
|
||||
CurText:=TextPath;
|
||||
TextPath:='';
|
||||
end;
|
||||
//debugln(['TTreeNodes.FindNodeWithTextPath CurText=',CurText,' Rest=',TextPath]);
|
||||
if Result=nil then
|
||||
Result:=FindTopLvlNode(CurText)
|
||||
else
|
||||
Result:=Result.FindNode(CurText);
|
||||
until (Result=nil) or (TextPath='');
|
||||
end;
|
||||
|
||||
function TTreeNodes.FindNodeWithData(const NodeData: Pointer): TTreeNode;
|
||||
begin
|
||||
Result := GetFirstNode;
|
||||
|
Loading…
Reference in New Issue
Block a user