Treeview issue lazarus / 31-LCL ---------------------------------------------------------------------- Rafael.Castro · 2021-11-17 20:38 I'm sorry I don't know how the order of things works but I would like to comment that the treeview component does not work 100%. I send file Code: TreeView.LoadFromFile( 'tree.txt') ; Thanks and apologies CHR$(20) ---------------------------------------------------------------------- wp · 2021-11-17 21:10 No, the treeview works correctly, your data file is faulty. Load the data file into the IDE (you must select file filter "All files" to see the text file), switch the editor to display special characters ("Tools" > " Options" > "Editor" > "General" > "Miscellaneous" > check "Show special characters" in the "Editor options" box). Now you see the tab characters as double arrows ">>" and spaces as a centered dot. Scroll towards the end of the file. The offending line is #39890. The text is "Animals.localized" but there is a space between the last tab and the "Animals". When you remove this space and repeat this with the lines for "Business", "Food", "Household", "People" and "Special" the file will load without error. Why is this space harmful? The treeview reads the lines into a stringlist, and then extracts the node level and the node text by means of the TTreeStrings method GetBufStart: 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 function TTreeStrings.GetBufStart(Buffer: PChar; var Level: Integer): PChar;begin  Level := 0;  while Buffer^ in [' ', #9] do  begin    Inc(Buffer);    Inc(Level);  end;  Result := Buffer;end;  You see the "while" condition? This means that the node level is determined by the number of spaces (' ') and tabs  (#9) before the non-white text. Having an additional space here has the consequence that this node has no parent, and this must crash the reading process. How did you create this file? Please check your code. ---------------------------------------------------------------------- Rafael.Castro · 2021-11-18 00:27 Good morning WP Thank you for your help But...  The code I use to scan the drives is the classic TSearchRec. Everything that TsearchRec sees I save in a text file and when I generate the treeview it is based on what TsearchRec has created. Today I received this error from a Mac user. I noticed that the character 20 was in front of the name, which I don't understand, but it crashes treeview. That is, the results I get from TSearchRec are crashing Treeview. The databases are already created with the chr$20. What do you recommend ? Thanks .. Index Your Files Translated with www.DeepL.com/Translator (free version) ---------------------------------------------------------------------- wp · 2021-11-18 17:45 Quote from: Rafael.Castro on November 18, 2021, 01:27:07 amThe code I use to scan the drives is the classic TSearchRec. Everything that TsearchRec sees I save in a text file and when I generate the treeview it is based on what TsearchRec has created. Today I received this error from a Mac user. I noticed that the character 20 was in front of the name, which I don't understand, but it crashes treeview. That is, the results I get from TSearchRec are crashing Treeview. The databases are already created with the chr$20. What do you recommend ? I am almost absolutely sure that the spaces are added somewhere by your code. Therefore, I can only say: study your code. Or post the code how you populate the TreeView with the SearchRec values, otherwise nobody can help. If you want to ask further questions on this please put them into a new thread and refer to this one. This thread is about the v2.2 release candidate, and your problems do not have to do anything with the new version. ---------------------------------------------------------------------- Rafael.Castro · 2021-11-19 20:59 Hello wp Apologies for posting this post in the wrong place. I have found that the same error occurs with the latest version of Delphi. Everything makes me think that I'm on the wrong track. But... On Mac it is allowed to start files with blank spaces. Linux and Windows do not. '     hello word' is OK for Mac 'space space space space  hello word' is OK for Mac Create Folder '           hola' is ok Create Folder 'space space space etc hola' is ok So, I see that Treeview fails at the Global level. The solution I know is to remove all spaces from the beginning of the file on Mac. Thanks for your help and forgive my recklessness. Translated with www.DeepL.com/Translator (free version) ---------------------------------------------------------------------- jamie · 2021-11-19 21:37 If Memory serves I believe the Space in the Tree view when loading from file is uses to indicate a child node. I could be wrong here but that seems to ring a bell.