Recent

Author Topic: VirtualStringTree - lazy node expanding  (Read 298 times)

Borneq

  • Full Member
  • ***
  • Posts: 238
VirtualStringTree - lazy node expanding
« on: January 29, 2020, 04:44:21 pm »
I want write subdirectory tree using VST. In beginning root is / or c:\ or all Windows drives, all nodes will collapsed. Folders should marked as expandable (+ sign) and regular files as unexpandable. If I click on folder + , should read items from filesystem and add childs. If this node will collaps again and again expand, should nothing do. Where can I find this basic example?
« Last Edit: January 29, 2020, 04:49:49 pm by Borneq »

Borneq

  • Full Member
  • ***
  • Posts: 238
Re: VirtualStringTree - lazy node expanding
« Reply #1 on: January 29, 2020, 05:34:36 pm »
O know:
1.set     
Code: Pascal  [Select]
  1. if XData^.IsDirectory then
  2.       XNode^.States:=XNode^.States+[vsHasChildren];
2.
Code: Pascal  [Select]
  1. procedure TForm1.VSTExpanding(Sender: TBaseVirtualTree; Node: PVirtualNode;
  2.   var Allowed: Boolean);
  3. var
  4.   XNode: PVirtualNode;
  5.   XData: PTreeData;
  6.   i: integer;
  7.   Items: TFileItemList;
  8. begin
  9.   if Node^.ChildCount>0 then exit;
  10.   Allowed:=true;
  11.   Items:=TFileItemList.Create;
  12.   FillItems(GetPath(Node)+'/*',Items);
  13.   if Items.Count=0 then
  14.   begin
  15.     Node^.States:=Node^.States-[vsHasChildren];
  16.     exit;
  17.   end;
  18.   for i:=0 to Items.Count-1 do
  19.   ...filling next level
  20.