Good morning,
what is the best way to find a node if you only know the text in a certain column?
Many thanks in advance
Gernot
Hi,
There is currently no method to find a node for a specific column based on a specific text. This will need to be done manually with the following code:
function TForm56.FindNodeByTextAndColumn(AText: string;
AColumn: Integer; ARecurse,
ACaseSensitive: Boolean): TTMSFNCTreeViewNode;
var
n: TTMSFNCTreeViewNode;
t: String;
begin
Result := nil;
n := TMSFNCTreeView1.GetFirstRootNode;
while Assigned(n) do
begin
t := n.Text[AColumn];
if TTMSFNCUtils.MatchStrEx(AText, t, ACaseSensitive) then
begin
Result := n;
Break;
end;
if ARecurse then
n := n.GetNext
else
n := n.GetNextSibling;
end;
end;
procedure TForm56.Button1Click(Sender: TObject);
var
n: TTMSFNCTreeViewNode;
begin
n := FindNodeByTextAndColumn('A5*', 0, True);
if Assigned(n) then
Log.d(n.Text[0]);
end;
For your convenience we have added this as a function to TTMSFNCTreeView which will be available in the next release.