Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fmx DialogService.MessageDialog how to use arguments #507

Answered by pyscripter
liuzg-rgb asked this question in Q&A
Discussion options

DialogService.ShowMessage('hello')
work well
DialogService.MessageDialog('hello2', 'TMsgDlgType.mtInformation', ['mbYesNo'], 'TMsgDlgBtn.mbYes', 0)
result
"MessageDialog" called with invalid arguments.
Error: Expected and actual arguments are incompatible

You must be logged in to vote

This works:

DialogService.MessageDialog('hello2', 'mtInformation', ['mbYes', 'mbNo'], 'mbYes', 0, None)

Replies: 3 comments 1 reply

Comment options

This works:

DialogService.MessageDialog('hello2', 'mtInformation', ['mbYes', 'mbNo'], 'mbYes', 0, None)

You must be logged in to vote
0 replies
Answer selected by pyscripter
Comment options

yes well but when click yes or no result always is None xx=DialogService.MessageDialog('hello2', 'mtInformation', ['mbYes', 'mbNo'], 'mbYes', 0, None ) print(xx)
...
________________________________ 发件人: pyscripter ***@***.***> 发送时间: 2025年7月13日 3:28 收件人: pyscripter/python4delphi ***@***.***> 抄送: liuzg-rgb ***@***.***>; Author ***@***.***> 主题: Re: [pyscripter/python4delphi] fmx DialogService.MessageDialog how to use arguments (Discussion #507) This works: DialogService.MessageDialog('hello2', 'mtInformation', ['mbYes', 'mbNo'], 'mbYes', 0, None) ― Reply to this email directly, view it on GitHub<#507 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BUSUHDGEPIU5HASXCEHOG6T3IHG4XAVCNFSM6AAAAACBMNLWDSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZUGE3DKNI>. You are receiving this because you authored the thread.Message ID: ***@***.***>
You must be logged in to vote
1 reply
Comment options

Of course since DialogService.MessageDialog is a procedure. I guess because on mobile platforms this is non-modal dialog.

class procedure MessageDialog(const AMessage: string; const ADialogType: TMsgDlgType;
 const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext;
 const ACloseDialogProc: TInputCloseDialogProc); overload;

I am afraid there is no way to provide a function for ACloseDialogProc. But you can use the procedure to show a simple message, with say an OK button (customizable version of ShowMessage).

@lmbelo Can we do some special wrapping of this and related functions?

Comment options

got it need Wrap TPyDelphiDialogServiceSync = class(TPyDelphiObject) private function GetDelphiObject: TDialogServiceSync; procedure SetDelphiObject(const Value: TDialogServiceSync); public class function DelphiObjectClass: TClass; override; public property DelphiObject: TDialogServiceSync read GetDelphiObject write SetDelphiObject; xx=DialogServiceSync.MessageDialog('hello2', 'mtInformation', ['mbYes', 'mbNo'], 'mbYes', 0 ) print(xx) ruslt a integer thanks
...
________________________________ 发件人: pyscripter ***@***.***> 发送时间: 2025年7月13日 6:03 收件人: pyscripter/python4delphi ***@***.***> 抄送: liuzg-rgb ***@***.***>; Author ***@***.***> 主题: Re: [pyscripter/python4delphi] fmx DialogService.MessageDialog how to use arguments (Discussion #507) Of course since DialogService.MessageDialog is a procedure. class procedure MessageDialog(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext; const ACloseDialogProc: TInputCloseDialogProc); overload; I am afraid there is no way to provide a function for ACloseDialogProc. But you can use the procedure to show a simple message, with say an OK button. ― Reply to this email directly, view it on GitHub<#507 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BUSUHDEVZ45ZY4OWTCUZJST3IHZEPAVCNFSM6AAAAACBMNLWDSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZUGE4TSNQ>. You are receiving this because you authored the thread.Message ID: ***@***.***>
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /