最近测试用XE7编写Android移动端软件,其中对话框可以直接使用showmessage将信息显示到手机界面,使用MessageDlg总是提示错误信息“Blocking dialogs not implemented on this platform”
if MessageDlg('确认退出系统吗?', TMsgDlgType.mtConfirmation,[TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0) = mrYes then
begin
Showmessage('Yes');
end
else
begin
Showmessage('No');
end;
经测试,修改为如下写法后,能在手机上正确显示提示信息
MessageDlg('确认退出系统吗?', System.UITypes.TMsgDlgType.mtInformation,[TMsgDlgBtn.mbYes,TMsgDlgBtn.mbNo,TMsgDlgBtn.mbCancel], 0,
procedure(const AResult: TModalResult)
begin
if AResult = mrYES then
ShowMessage('Yes') else
if AResult = mrNo then
ShowMessage('No') else
if AResult = mrCancel then
ShowMessage('Cancel');
end);