Hi Adam,
Bart's suggestion work well for me ....
Try to do this ...
In your form declare something like Done : Boolean; LinkStr : String; and insert one label (LinkLabel)
Change procedure TForm1.Button1Click(Sender: TObject)
to
procedure TForm1.Button1Click(Sender: TObject);
Var it: TTMSFNCCloudDropBoxItem;
begin
LinkStr='';
Done:=False;
TTMSFNCCloudDropBox(CloudStorage.Storage).OnGetShare := GetShare;
repeat // 1
it := CloudListbox.Items[CloudListBox.ItemIndex].DataObject as TTMSFNCCloudDropBoxItem;
TTMSFNCCloudDropBox(CloudStorage.Storage).GetShare(it);
repeat // 2
Sleep(100);
Application.ProcessMessages;
until Done ;
until LinkStr<>'';
LinkLabel.Caption:=LinkStr;
end;
and, just for example, change
procedure TForm1.GetShare(Sender: TObject; const AShare: string;
const ARequestResult: TTMSFNCCloudBaseRequestResult);
var
share_string : String ;
begin
share_string := AShare ;
LinkStr:=share_string;
Done:=True;
end;
With this code all work ..... and the selected item link is returned in linkStr.
Due the fact that Getshare is "asynchronous" you need to wait some time in order to finish operation.
The "waste" time is rapresented by repeat until block (2), when the link is retuned ...Done is true and all is done.
1: This repeat unitl is need because sometimes, i don't know why, at first round LinkStr is empty and on second round return the value. In this way each time you click on the button, you'll have the rigth link.
Hope you can resolve the problem.
Regards
Daniele