dolphin King
asked on
find a node in VST
i am using this function to find node in treeview
and i use it like so
so this code search for node in Vst and if the node exits stop the code execution and if does not exits do the rest
but some times this function got bypassed i mean when a node is already exits the if statement of node <> nil does not detect that its not nil and continue executing the code.
function TFORM1.lookingTreeView(name: String): PVirtualNode;
var
Node: PVirtualNode;
Data: PUserData;
begin
Result := nil;
Node := VDT1.GetFirst;
while ((Node <> nil) and (Result = nil)) do
begin
Data := VDT1.GetNodeData(Node);
if (Data.FObject.name= name) then
begin
Result := Node;
break;
end
else
Node := VDT1.GetNext(Node);
end;
end;
and i use it like so
Node := lookingTreeView(namedata);
if Node <> nil then
begin
// then stop execute the code
exit;
end;
// if its nil then do execute the rest of code
so this code search for node in Vst and if the node exits stop the code execution and if does not exits do the rest
but some times this function got bypassed i mean when a node is already exits the if statement of node <> nil does not detect that its not nil and continue executing the code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why not reverse the logic ?
Open in new window