baquelo 0 Posted January 16, 2019 Hi!!I need a confirmation box (Yes and No options) in Android, but in Delphi 10.3 dont work, the app crash... In the Delphi 10.1 work fine... Function TForm1.mensagemConfirmacao(pMensagem: String): TModalResult; Var MR: TModalResult; Begin MR := mrNone; TDialogService.MessageDialog(pMensagem, TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], TMsgDlgBtn.mbYes, 0, Procedure(Const AResult: TModalResult) Begin MR := AResult; End); While MR = mrNone Do begin Application.ProcessMessages; end; result := MR; End; Help me please!! Share this post Link to post
mausmb 13 Posted January 16, 2019 (edited) This code working just fine in 10.3 Android & Windows ... dont' know with Tmodalresult TDialogService.MessageDialog((mymessage), system.UITypes.TMsgDlgType.mtConfirmation, [system.UITypes.TMsgDlgBtn.mbYes, system.UITypes.TMsgDlgBtn.mbNo], system.UITypes.TMsgDlgBtn.mbYes,0, procedure (const AResult: System.UITypes.TModalResult) begin case AResult of mrYES: Begin ..... br, Edited January 16, 2019 by mausmb 1 Share this post Link to post
baquelo 0 Posted January 22, 2019 On 1/16/2019 at 4:10 PM, mausmb said: This code working just fine in 10.3 Android & Windows ... dont' know with Tmodalresult TDialogService.MessageDialog((mymessage), system.UITypes.TMsgDlgType.mtConfirmation, [system.UITypes.TMsgDlgBtn.mbYes, system.UITypes.TMsgDlgBtn.mbNo], system.UITypes.TMsgDlgBtn.mbYes,0, procedure (const AResult: System.UITypes.TModalResult) begin case AResult of mrYES: Begin ..... br, Thanks for reply! I reinstall Delphi 10.1. Share this post Link to post
Rollo62 536 Posted January 22, 2019 (edited) On 1/16/2019 at 1:22 PM, baquelo said: While MR = mrNone Do begin Application.ProcessMessages; end; I always consider the Application.ProcessMessages suspicious, do you really need this ? Usualy I'm fine when reacting to my stuff directly in the anonymous procedure. Edited January 22, 2019 by Rollo62 1 Share this post Link to post
baquelo 0 Posted January 22, 2019 7 hours ago, Rollo62 said: I always consider the Application.ProcessMessages suspicious, do you really need this ? Usualy I'm fine when reacting to my stuff directly in the anonymous procedure. I'm a beginner in Delphi and I picked up a project in the company where the programmer used the code that way. I was just migrating the Delphi 10.1 project to Delphi 10.3. I did not really think about using the anonymous procedure. Soon I will reinstall Delphi 10.3 and I will proceed to use the anonymous procedure. Many thanks for the reply. Share this post Link to post
Rollo62 536 Posted January 23, 2019 The anonymous procedure helps to keep your app responsive, instead just showing a modal dialog or form. This is required on mobile devices, but I also highly recommend to use the same strategy for desktop too. There are many other methods to prevent unwanted user actions while the dialog is shown, beside modal dialogs and forms. 1 Share this post Link to post
KASKAGROSSA 0 Posted February 3, 2021 Just use Multview to result by another button procedure... I did it and 100% works fine... Share this post Link to post