I notice that a new Topic cannot be opened in the TMS FNC Cloud Pack support forum.
I cannot see such issue here.
Most likely this is because there is no active TMS FNC Cloud Pack license?
Licensed users have write access, all other users have read access.
I purchased a licence on August 3rd. I guess it hasn't filtered through to the support forum yet.
Still not able to post.
Well, still not able to post. So here are a couple of FNC Cloud Pack questions I Have:
-
When setting up the Azure AD Oauth2 Authentication for OneDrive access, which Platform should be used: SPA or Mobile or Desktop application? I assume the latter as my app is a Desktop app. Also, should we be using Azure AD Graph or Microsoft Graph?
-
I'm adapting the TMS VCL Cloud Pack Demos\CloudAdvStorageDemo's File Details feature to use in the TMSFNCCloudStorageServices Demo - and changing the former's TreeView1 to a TMSFNCListBox in the FNC demo. GoogleDrive works ok (and shows all the files in the TMSFNCListBox), but I'm not sure how to change line:
ci := TCloudItem(TreeView1.Selected.Data);
in ported Procedure TFormCloudStorage.ShowItem to create a TCloudItem from the selected TMSFNCListBox item and be able to display a file's details in a File Details TGroupBox.
ci := TTMSFNCCloudItem(TMSFNCListBox1.SelectedItem.DataPointer);
doesn't work - I get an AV. Is it possible to do this?
Hi,
-
You should now be able to post in both the TMS VCL Cloud Pack and TMS FNC Cloud Pack categories.
You might need to need to re-login first though. -
Please use the "Web" platform as indicated in the documentation:
- Can you please make sure to use SelectedItem.DataObject instead?
Example:
ci := TMSFNCListBox1.SelectedItem.DataObject as TTMSFNCCloudItem;
Thanks Bart. Using the following code in ported Procedure TFormCloudStorage.ShowItem gives an AV:
procedure TFormFNCCloudStorage.TMSFNCListBox1ItemClick(Sender: TObject;
AItem: TTMSFNCListBoxItem);
begin
showmessage(AItem.Text);
Screen.Cursor := crHourGlass;
ShowItem(AItem);
Screen.Cursor := crDefault;
end;
procedure TFormFNCCloudStorage.ShowItem(AItem: TTMSFNCListBoxItem);
var
ci: TTMSFNCCloudItem;
begin
//if Assigned(TreeView1.Selected) then
if Assigned(TMSFNCListBox1.SelectedItem) then
begin
//ci := TCloudItem(TreeView1.Selected.Data);
ci := TMSFNCListBox1.SelectedItem.DataObject as TTMSFNCCloudItem;
(if (ci is TBoxNetItem) then //Not reqd
(ci as TBoxNetItem).LoadFileInfo;)
showmessage(AItem.Text); <-- OK
showmessage(ci.FileName); <-- AV
Any idea why this doesn't work?
I think this is the reason (in procedure TFormFNCCloudStorage.FillListBox(AItems: TTMSFNCCloudItems; AAddFolders, AAddFiles: Boolean):
if ((ci.ItemType = ciFolder) and AAddFolders) or ((ci.ItemType = ciFile) and AAddFiles) then
//TMSFNCCloudDemoListBox1.AddItem(AItems.Items[I].Filename, ftype, ci); <--The Demo listbox
TMSFNCListBox1.AddItem(AItems.Items[I].Filename, {ftype, ci}); <-- My ListBox
Using an 'ordinary' ListBox instead of the TMSFNCCloudDemoListBox means the entries are missing the 'ftype' and 'ci' parameters - hence the AV I suspect. In an earlier post Pieter said the TMSFNCCloudDemoListBox is only for use in the demo - not working apps. See:
'The TTMSFNCCloudDemoListBox is a component that is registered purely for using it inside the demo. Please use the TTMSFNCListBox or TTMSFNCTableView which are included in the TMS FNC UI Pack.'
Is there a way round this?
Yes, you still need to assign the TTMSFNCCloudItem (ci) to the DataObject of the new TTTMSFNCListBox item.
Example:
procedure TForm1.FillListBox(AItems: TTMSFNCCloudItems);
var
I: Integer;
ci: TTMSFNCCloudItem;
lit: TTMSFNCListBoxItem;
begin
if not Assigned(AItems) then
Exit;
TMSFNCListBox1.BeginUpdate;
for I := 0 to AItems.Count - 1 do
begin
ci := AItems.Items[I];
lit := TMSFNCListBox1.AddItem(AItems.Items[I].FileName);
lit.DataObject := ci;
end;
TMSFNCListBox1.EndUpdate;
end;
That was it. Many thanks Bart.
Andrew
Happy to help!