TAdvTreeView - change text color of selected node permanenty

i have a TAdvTreeView and i need to modify the text color of the selected node, but this must be permanently (id est if i select another node, the previously selected node must preserve the new color), and i need to do it at a specific time in the software, so i cannot use events like OnAfterSelectNode. How can i do it?

That's not possible. The node is colored through events. You need to use the OnBeforeDrawNode, change the color, and whenever you need the color to be applied, you can set a flag and call AdvTreeView.BeginUpdate / AdvTreeView.EndUpdate or a repaint.

Thanks for the answer, with your help i somehow managed to make the code work