Display Expanded Nodes

Using the CloudStorageDemo, I cannot see how to display the nodes in expanded mode when the cloud storage tree is first displayed after being connected. Clicking the nodes expands them normally and the buttons are then displayed, but the node buttons are not displayed until the nodes are manually clicked. The TreeView1 showbuttons property is True, but has no effect. Any ideas on how to achieve this feature?

There may be a simpler way, but running the following procedure from the ConnectBtnClick does the job:

procedure TFormCloudStorage.ExpandTreeNode(TV : TTreeView; NodeText : string);


   TN : TTreeNode;


   TN := TV.Items.GetFirstNode; // get top node

   {run through nodes looking for the text}

   while TN <> nil do begin

     if TN.Text = NodeText then

       {found it}


     TN := TN.GetNext; // look at next node


   if TN <> nil then

     {expand the node}

     TN.Expand(False); // only that node expands

     //TN.Expand(true); // that node and all its children expand



And, the node buttons need to be showing for this to work. Set CloudTreeViewAdapter1 InitMethod to cmDrive; cmRoot doesn't work.


You should indeed use the cmDrive option to make the node indicators display right away.
Note that this will download the full file/folder structure at once where the other option will only download a single folder's contents at a time.
This technique is used to improve performance on drives that contain a high number of files.

Thanks Bart - very helpful.