Avatar of Member_2_7965240
Member_2_7965240

asked on 

Delphi Firmonkey, Android: blocking dialogs not implemented on this platform

Hello,

I use Delphi Seattle.

I have a MessageDlg like this:
      if MessageDlg('Would you like to continue?'
      , TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbOK, TMsgDlgBtn.mbCancel], -1) = mrOK then

But on Android I get this error message:  "blocking dialogs not implemented on this platform"

How can I ask then the user to choose?

Thank you.
DelphiAndroidSmartphone Programming

Avatar of undefined
Last Comment
Sinisa Vuk
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

You should use anonymous method like described in this article..
This is snippet from it (fmxexpress):
MessageDlg('Do you want to press yes or no?', System.UITypes.TMsgDlgType.mtInformation,
[
System.UITypes.TMsgDlgBtn.mbYes, System.UITypes.TMsgDlgBtn.mbNo
], 0,
procedure(const AResult: TModalResult)
begin
case AResult of
{ Detectwhichbuttonwaspushedand show a differentmessage }
mrYes:
begin
// pressed yes
end;
mrNo:
begin
// pressed no
end;
end;
end
);
//....

Open in new window

Avatar of Member_2_7965240
Member_2_7965240

ASKER

Hello,

Thank you for the answer. It did pop up but in the background, it continued everything which was after the MessageDlg.

MessageDlg('Do you want to press yes or no?', System.UITypes.TMsgDlgType.mtInformation,
ShowMessage('xxx');

Open in new window

If I use the code above in a Vcl app, first it waits for the user to chose the MessageDlg option, then the  ShowMessage would fire.
However, on Android I saw the ShowMessage first and then the MessageDlg.

This is weird, this way MessageDlg is useless on Android. What do you think?
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Member_2_7965240

ASKER

Hello,

Is TDialogService in Delphi Seattle too? I put FMX.DialogService in Uses list but it couldn't find it.

Thank you.
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

don't know ... but  instead of TDialogService.MessageDialog use MessageDlg. Then you don't need any additional uses...
Delphi
Delphi

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

60K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo