TWebOpenDialog doesn't complete if cancelled?

Hi,

If I run the following code:

procedure TForm1.WebButton1Click(Sender: TObject);
var 
  pick:TWebOpenDialog;
  s:string;
begin
  try
    pick:=TWebOpenDialog.Create(Self);
    await(String, pick.Perform);
  finally
    pick.Free;
    WriteLn('this should execute');
  end;

I would expect the finally block to trigger after the user has selected a file(s) or closed the window or pressed cancel on the dialog.

However, it runs only if a file(s) has been selected.

Is this expected behaviour or an error? If it is expected, how does one go about executing code after the .perform() in the event the user closes the window?

Thanks

We investigated this here and when you just open the dialog and press Cancel, i.e. no selection at all is performed, the HTML element doesn't trigger an event that we can catch to finish the promise. This appears to be a limitation of the HTML INPUT element of type FILE. We will investigate if workarounds or other solutions for this exist.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.