How can I make a file explorer using VirtualTreeView? lazarus / 21-General ---------------------------------------------------------------------- Froxter · 2025-04-26 08:35 Someone recommended me to install this package and I don't know very well how to use it to create my explorer, but in case it can't be done then how can I do it using a TreeView and a FileListBox? ---------------------------------------------------------------------- maurog · 2025-04-26 09:05 "Is there a specific reason why you are not using ShellTreeView and ShellListView? I believe with these components you'd have less effort. Here's even a small example:" https://lazplanet.blogspot.com/2013/06/create-simple-file-browser- in-2-minutes.html Regards Maurog. ---------------------------------------------------------------------- Ally · 2025-04-26 09:13 Hello Froxter, at https://forum.lazarus.freepascal.org/index.php/topic,70909.msg55309 4.html#msg553094 you can find an example that shows how it works with ShellTreeView and ShellListView. Greetings Roland ---------------------------------------------------------------------- Froxter · 2025-04-26 09:19 Quote from: Ally on April 26, 2025, 11:13:31 amHello Froxter, at https://forum.lazarus.freepascal.org/index.php/topic,70909.msg55309 4.html#msg553094 you can find an example that shows how it works with ShellTreeView and ShellListView. Greetings Roland I understand that i can make it easy with these components and i did it before! but im changing it because that creashed my programs when i run them in windows XP and i really need my programs run in that OS ---------------------------------------------------------------------- wp · 2025-04-26 09:19 I agree with maurog and Ally that the combination of ShellTreeView and ShellListView is very easy to use. If you insist on VirtualTreeView you should know that usually there is no need to install anything for it because it is bundled with Lazarus (package "laz.virtualtreeview", palette "LazControls"). An explorer- like sample project can be found in unit DrawTreeDemo of the vst_advanced project (in folder "examples/virtualtreeview" of the Lazarus installation). Somewhere in the forum, there is also code for an elemental worked-out file explorer, but I did not find it any more. ---------------------------------------------------------------------- wp · 2025-04-26 09:23 Quote from: Froxter on April 26, 2025, 11:19:34 amI understand that i can make it easy with these components and i did it before! but im changing it because that creashed my programs when i run them in windows XP and i really need my programs run in that OS You should report this. I don't see a reason why the ShellCtrls should not work in Win XP. ---------------------------------------------------------------------- Froxter · 2025-04-26 09:25 Quote from: wp on April 26, 2025, 11:23:44 amQuote from: Froxter on April 26, 2025, 11:19:34 amI understand that i can make it easy with these components and i did it before! but im changing it because that creashed my programs when i run them in windows XP and i really need my programs run in that OS You should report this. I don't see a reason why the ShellCtrls should not work in Win XP. in XP when i add a ShellTreeView in my form i get a crash of access violation. Im using lazarus 3.8 ---------------------------------------------------------------------- wp · 2025-04-26 09:49 Just saw in yesterday's commit notes of Lazarus/main: "Win32, LCL: fix crash of TWin32WSCustomShellTreeView on Win-XP." I checked it in a VM with Win XP and it removes the crash. You can apply this change easily to your own version: Make a backup copy of file lcl/interfaces/win32/win32wsshellctrls.pas (just in case something goes very wrong...)Load this file into the IDE, find the implementation of class function TWin32WSCustomShellTreeView.GetBuiltinIconSizeBetween the lines "ico := ..." and "try" add the following highlighted block: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     ...    ico := GetShellIcon(WideString('C:'));    if ico = nil then    begin    Result := Types.Size(0, 0);      exit;    end;    try    ...Rebuild the IDE ("Tools" > "Build Lazarus") ---------------------------------------------------------------------- Froxter · 2025-04-26 11:31 Quote from: wp on April 26, 2025, 11:49:57 amJust saw in yesterday's commit notes of Lazarus/main: "Win32, LCL: fix crash of TWin32WSCustomShellTreeView on Win-XP." I checked it in a VM with Win XP and it removes the crash. You can apply this change easily to your own version: Make a backup copy of file lcl/interfaces/win32/win32wsshellctrls.pas (just in case something goes very wrong...)Load this file into the IDE, find the implementation of class function TWin32WSCustomShellTreeView.GetBuiltinIconSizeBetween the lines "ico := ..." and "try" add the following highlighted block: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     ...    ico := GetShellIcon(WideString('C:'));    if ico = nil then    begin    Result := Types.Size(0, 0);      exit;    end;    try    ...Rebuild the IDE ("Tools" > "Build Lazarus") OMG IT WORKS PERFECTLY!! YTSM :,D