[SOLVED] Save treeview nodes expand / collapse state lazarus / 21-General ---------------------------------------------------------------------- Hansvb · 2022-12-16 15:39 Hi, I would like to save the expand/collapse status of the treeview nodes. I find a Node.StateIndex but it always seems to be -1. I also find TNodeStates and specifically nsExpanded. However, I have no idea how to approach that. How can you record the expand/collapse status of each node? Where to start looking for this? ---------------------------------------------------------------------- wp · 2022-12-16 16:03 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   if Node.Expanded then ShowMessage('Node is expanded'); Node.StateIndex, on the other hand, is an additional image index to symbolize a given state of the node, for example "node is checked". ---------------------------------------------------------------------- jcmontherock · 2022-12-16 16:39 You can use the path of the final node. Each part of the path should be expanded to find the last node. I am not sure that I understand your needs. ---------------------------------------------------------------------- Hansvb · 2022-12-16 16:45 I was searching in the wrong direction (for a long time today) Quoteif Node.Expanded then ShowMessage('Node is expanded');It is that easy. Thanks.