FranzB 0 Posted September 14, 2021 Delphin 10.4 does not compile this code , but to my understanding this is a correct set of parameters calling MessageDialog FMX version TDialogService.MessageDialog('You want to ........ ', TMsgDlgType.mtConfirmation, TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo, nil, procedure(const aResult: TModalResult) begin if (aResult = mrYes) then begin // Write code here for pressing button OK ...... Label_Statusbar.Text := ' -> done '; end else begin // Write code here for pressing button NO ...... Label_Statusbar.Text := ' -> canceled '; end; end ); end; Share this post Link to post
vfbb 285 Posted September 14, 2021 TDialogService.MessageDialog('You want to ........ ', TMsgDlgType.mtConfirmation, mbYesNo, TMsgDlgBtn.mbNo, nil, procedure(const aResult: TModalResult) … Share this post Link to post
FranzB 0 Posted September 14, 2021 still no luck, compiling this code .... TDialogService.MessageDialog('You want to ........ ', TMsgDlgType.mtConfirmation, mbYesNo, TMsgDlgBtn.mbNo, nil, procedure(const aResult: TModalResult) begin if (aResult = mrYes) then begin // Write code here for pressing button OK // ...... Label_Statusbar.Text := ' -> done '; end else begin // Write code here for pressing button NO // ...... Label_Statusbar.Text := ' -> canceled '; end; end ); Share this post Link to post
Remy Lebeau 1394 Posted September 14, 2021 (edited) 2 hours ago, FranzB said: still no luck, compiling this code .... Look at the actual declaration more carefully: class procedure MessageDialog( const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext; const ACloseDialogProc: TInputCloseDialogProc); The 3rd parameter is a TMsgDlgButtons, which is a Set of TMsgDlgBtn. But you were originally trying to pass a single TMsgDlgBtn. Also, the 5th parameter is a THelpContext, which is an integer, not a pointer. So, you can't pass nil to it. Try this: TDialogService.MessageDialog( 'You want to ........ ', TMsgDlgType.mtConfirmation, mbYesNo, // or [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo] TMsgDlgBtn.mbNo, 0, procedure(const aResult: TModalResult) begin ... end ); Edited September 14, 2021 by Remy Lebeau Share this post Link to post