I've based my prototype on the bundled CloudStorageServiceDemo project. That project has a CurrentFolder variable of type TTMSFNCCloudItem which keeps track of the currently selected folder as the user navigates the hierarchy.
In a similar fashion I want to keep track of a selected folder where files will be uploaded to, so I have declared a global variable Cloud_Folder, also of type TTMSFNCCloudItem to reference this. However this variable is being overwritten as the program executes.
Am I missing something about how global variables interact with FNC Cloud Pack?
If I create a new instance of a TTMSFNCCloudItem, that requires a TCollection parameter which I can't see any documentation for.
Sorry, I'm probably doing something basically wrong here, but I would appreciate any help offered.
Regards,
Adam
Hi,
You should not instantiate TTMSFNCCloudItem collection item classes. The way to interact with files/folders is by using:
CloudStorage.Upload
CloudStorage.Download
CloudStorage.CreateFolder
CloudStorage.GetFolderList (retrieves are all current items)
Sorry, I replied back by email but the contents haven't made it into this thread.
Thanks for confirming I shouldn't instantiate CI classes.
How would you suggest I keep a copy of a CloudItem so I can reference which folder is being used as the destination for file copies?
We use a method to store the item inside a TTMSFNCTreeView, specifically in the DataObject of a node:
procedure TForm1.FillTreeView(ATreeView: TTMSFNCTreeView; ADrive: TTMSFNCCloudItems);
procedure AddFolder(pn: TTMSFNCTreeViewNode; d: TTMSFNCCloudItems);
var
tn: TTMSFNCTreeViewNode;
i: integer;
begin
for i := 0 to d.Count - 1 do
begin
tn := ATreeView.AddNode(pn);
tn.Text[0] := d.Items[i].FileName;
tn.DataObject := d.Items[i];
if (d.Items[i].ItemType = ciFolder) then
begin
if Assigned(d.Items[i].Folder) then
AddFolder(tn, d.Items[i].Folder);
end
else
tn.Text[1] := IntToStr(d.Items[i].Size);
end;
end;
begin
if Assigned(ATreeView) then
begin
ATreeView.BeginUpdate;
ATreeView.ClearNodes;
AddFolder(nil, ADrive);
ATreeView.EndUpdate;
end;
end;