简体   繁体   English

Async InputQuery不处理“取消”按钮

[英]Async InputQuery doesn't handle Cancel button

I'm using a simple call to TDialogServiceAsync.InputQuery() with a single input. 我正在使用单个输入对TDialogServiceAsync.InputQuery()进行简单调用。 It just ignores both the Cancel button and the window's X close button. 它只是忽略了Cancel按钮和窗口的X关闭按钮。

But the Ok button works fine. Ok按钮工作正常。

This is my code: 这是我的代码:

uses
  FMX.DialogService.Async;

procedure TForm1.Button1Click(Sender: TObject);
begin
  TDialogServiceAsync.InputQuery('Title',
   ['Insert value'], ['bla bla'],
  procedure(const AResult: TModalResult; const AValues: array of string)
  begin
    if Aresult = mrOk then
      ShowMessage('Ok!');

    if Aresult = mrCancel then
      ShowMessage('Cancel!'); // this is never called
  end);
end;

If I press Cancel , the InputQuery window doesn't close, and my callback procedure is not called. 如果我按下Cancel ,则InputQuery窗口不会关闭,并且不会调用我的回调过程。

How I can make the InputQuery form close when pressing the Cancel button? 按“ Cancel按钮时,如何关闭InputQuery表单?

I'm using RADStudio 10.1 Berlin. 我正在使用RADStudio 10.1柏林。


Edit: 编辑:

I made a few tests: 我做了几个测试:

  1. On Windows 32 bit cancel button DOES NOT works 在Windows 32位取消按钮不起作用
  2. On Windows 64 bit cancel button DOES NOT works 在Windows 64位取消按钮不起作用
  3. On iOS 64 bit cancel button works correctly 在iOS 64位取消按钮正常工作
  4. On Android 32 bit cancel button works correctly 在Android 32位取消按钮正常工作

This is a known bug. 这是一个已知的错误。 There are already bug reports for this issue in Embarcadero's Quality Portal : 在Embarcadero的Quality Portal中已经有关于此问题的错误报告:

RSP-16148 TDialogService.InputQuery() - Cancel button doesn't work RSP-16148 TDialogService.InputQuery() - 取消按钮不起作用

RSP-16670 Problem of TDialogService.InputQuery dialog box . RSP-16670 TDialogService.InputQuery对话框问题

The latter ticket provides a fix to FMX.DialogHelper.pas : 后一张票提供了对FMX.DialogHelper.pas的修复:

open 打开

 FMX.DialogHelper.pas 

find

 class function TDialogBuilder.InputQuery(const ACaption: string; const APrompts: array of string; 

find

 Button := CreateButton(LForm, BorderSize, WorkArea, Layout, SMsgDlgCancel, mrCancel, LForm.ButtonOnClick); 

after this line, add 在这一行之后,添加

 //fix or add by flyign wang. Button.Cancel := True; LForm.FCanCancel := True; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM