Problem compiling "CloudStorageServiceDemoVCL" demo program with delphi 11

Good afternoon to all, I've downloaded and installed last version of all fnc components, fnc cloud included (2.5.01).

I tried to run the "CloudStorageServiceDemoVCL" demo program but i got this error.

[dcc32 Error] UCloudStorageService.pas(237): E2003 Undeclared identifier: 'ParentID'
[dcc32 Fatal Error] CloudStorageServiceDemoVCL.dpr(5): F2063 Could not compile used unit 'UCloudStorageService.pas'

This is the procedure with the error ..

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(CurrentFolder.ParentFolder) then
//  begin
//    CurrentFolder := CurrentFolder.ParentFolder;
//    lPath.Caption := Copy(lPath.Caption, 0, LastIndexOf(lPath.Caption, '\'));
//    if lPath.Caption = '' then
//      lPath.Caption := 'root';
//    TMSFNCCloudStorageServices1.GetFolderListHierarchical(CurrentFolder);
//  end
//  else
//  begin
//    CurrentFolder := nil;
//    lPath.Caption := 'root';
//    TMSFNCCloudStorageServices1.GetFolderList;
//  end;

  if Assigned(CurrentFolder) and Assigned((*here ----> *)CurrentFolder.ParentID) then 
  begin
    CurrentFolder := CurrentFolder.ParentFolder;
    lPath.Caption := Copy(lPath.Caption, 0, LastIndexOf(lPath.Caption, '\'));
    if lPath.Caption = '' then
      lPath.Caption := 'root';
    TMSFNCCloudStorageServices1.GetFolderListHierarchical(CurrentFolder);
  end
  else
  begin
    CurrentFolder := nil;
    lPath.Caption := 'root';
    TMSFNCCloudStorageServices1.GetFolderList;
  end;
end;

CurrentFolder is declared as TTMSFNCCloudItem ... but parentId is missing ...

Please, can you check this demo ?

Thank's for your attention

Regards
Daniele

Thank you for notifying.
Please download the corrected source here:

VCLCloudStorageServiceDemo.zip (2.5 KB)

The updated demo will also be included with the next TMS FNC Cloud Pack release.

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

Thank you for your suggestion.
We'll have to investigate to improve the demo behavior in a future version.

Solved a huge problem. Thanks!