Modal Android Dialog using Delphi 10.2.1 Tokyo

  

I have the following Delphi code for showing a modal message on Android which worked fine on 10.1 Berlin, but stopped working on Delphi 10.2.1 Tokyo. This procedure now hangs the Android app.

procedure customShowMessage(AMessage: string);
//good idea to have our own procedure that we can tweak, as even for VCL and windows, we have done show message differently over the years due to all sorts of funny problems
var
LModalWindowOpen: boolean;
begin
LModalWindowOpen := true;

TDialogService.MessageDialog(AMessage, TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbOK], TMsgDlgBtn.mbOK, 0,
procedure(const AResult: TModalResult)
begin
LModalWindowOpen := false;
end);

while LModalWindowOpen do
begin
Application.ProcessMessages; //since 10.2 Tokyo, popup never shows and this loops forever
end;
end;

I suspect it possibly has something to do with the change in Tokyo as to how the app runs in the main thread. Not sure what I can replace Application.ProcessMessages with that will let the dialog show, so that the user can click on something.

I have a lot of places this is used, so changing it to work using a callback is going to be a lot of work, and restructuring.

Comments are closed.