Hi Bart, thank you for your very quick reply.
However there is a little problem more ...
When i click on "UP" button the program "reload" the main root ..... even if i'm in a sub, sub, directory.
This because the Currentfolder.ParentFolder is always nil.
To avoid this situation, i made a little change like that; maybe not elegant but do the job. If you think this change can be usefuly to someone, please update the code.
In the demo, under form's private declaration add
LastParentdir : TTMSFNCCloudItem;
in "openfolder button" add this line
LastParentdir:=CurrentFolder;
before
ci := TMSFNCCloudDemoListBox1.Items[TMSFNCCloudDemoListBox1.ItemIndex].DataObject as TTMSFNCCloudItem;
and the upbutton will be
procedure TForm4.btUpClick(Sender: TObject);
function LastIndexOf(const S: string; const Chr: Char): Integer;
var
i: Integer;
begin
result := 0;
for i := length(S) downto 1 do
if S[i] = Chr then
begin
result := i-1;
break;
end;
end;
begin
if Assigned(CurrentFolder)and Assigned(LastParentdir) (*Assigned(CurrentFolder.ParentFolder)*) then
begin
//CurrentFolder := CurrentFolder.ParentFolder;
CurrentFolder:=LastParentdir;
lPath.Caption := Copy(lPath.Caption, 0, LastIndexOf(lPath.Caption, '\'));
if lPath.Caption = '' then
lPath.Caption := 'root';
TMSFNCCloudStorageServices1.GetFolderListHierarchical(CurrentFolder);
LastParentdir:=CurrentFolder.ParentFolder;
end
else
begin
CurrentFolder := nil;
lPath.Caption := 'root';
TMSFNCCloudStorageServices1.GetFolderList;
end;
end;
After did the update, when click on "up button" the program will reload the real parentfolder instead read the root.
Thank's for attention
Regards
Daniele