Upload the FillTreeView

Running on Android with XE8.



My application is based on the FireMonkey Cloud Storage Demo.



Basically the cod looks like this:



    fn := TPath.Combine(SharedCardPath, f_str);



    if Assigned(TreeView1.Selected) then

    begin

      ci := TTMSFMXCloudItem(TTMSFMXCloudTreeViewItem(TreeView1.Selected).DataObject);

      nci := Storage.Upload(ci, fn);



      if Assigned(nci) then

      begin

        Storage.FillTreeView(TreeView1);

      end;

    end;



The Upload works correctly and returns an Assigned value for nci.

The call to FillTreeView fails with an "Argument out of range" error.

This happens if I upload a new file or overwrite an existing one.



Any clues?



Graham

Hi,

Are you sure the DataObject contains a value?
Can you perhaps try to clear the Treeview before filling it with data?

Kind Regards, 
Pieter

Clearing the TreeView first seems to solve the problem. And the call to GetDriveInfo also seems to improve the TreeView display.



      if Assigned(nci) then

      begin

        TreeView1.Clear;

        MyStorage.GetDriveInfo;

        MyStorage.FillTreeView(TreeView1);

      end;



I have another observation now that I will start in a new post.