zoukankan      html  css  js  c++  java
  • FMX 模态窗体

    FMX 模态窗体

    dlg := TForm2.Create(nil);
      dlg.ShowModal(procedure(ModalResult: TModalResult)
      begin      
         if ModalResult = mrOK then      
         begin
         .....
         end;

    http://docwiki.embarcadero.com/RADStudio/Seattle/en/Using_FireMonkey_Modal_Dialog_Boxes

    https://forums.embarcadero.com/thread.jspa?threadID=117516

    http://blog.marcocantu.com/blog/xe5_anonymous_showmodal_android.html

    为何我的ModalForm全屏了呢?

     Displaying a Modal Dialog Box

    Use the following code to display a modal dialog box in your FireMonkey application:

    Delphi:

    procedure MyCurrentForm.MyButtonClick(Sender: TObject);
    var
      dlg: TMyModalForm;
    begin
      // Create an instance of a form.
      dlg := TMyModalForm.Create(nil);
     
      // Configure the form. For example, give it a display name.
      dlg.Caption := 'My Modal Dialog Box';
     
      // Show your dialog box and provide an anonymous method that handles the closing of your dialog box.
      dlg.ShowModal(
        procedure(ModalResult: TModalResult)
        begin
          // Do something.
        end
      );
    end;

    C++:

    1. Define a class that takes the TProc__1 interface, and define a function to handle the closing of your dialog box:
    class TModalFormCallback : public TCppInterfacedObject<TProc__1<TModalResult> > {
    public:
      TMyModalForm *dlg;
      TMyCurrentForm *MyCurrentForm;
     
      void __fastcall Invoke(TModalResult ModalResult) {
        // Do something.
      }
    };
    2. Then pass an instance of this class to ShowModal:
    void __fastcall TMyCurrentForm::MyButtonClick(TObject *Sender) {
      // Create an instance of a form.
      TMyModalForm *dlg = new TMyModalForm(NULL);
     
      // Configure the form. For example, give it a display name.
      dlg->Caption = "My Modal Dialog Box";
     
      // Create and configure an instance of your callback method.
      TModalFormCallback* ModalFormCallback = new TModalFormCallback();
      ModalFormCallback->dlg = dlg;
      ModalFormCallback->MyCurrentForm = this;
     
      // Show your dialog box and provide an anonymous method that handles the closing of your dialog box.
      dlg->ShowModal(ModalFormCallback);
    }

    Freeing Your Modal Dialog Box

    You cannot free the memory allocated for your modal dialog box form within the method than handles the closing of your modal dialog box form. To free your modal dialog box form, you must handle its OnClose event as follows:

    Delphi:

    procedure TMyModalForm.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Action := TCloseAction.caFree;
    end;

    C++:

    void __fastcall TMyModalForm::FormClose(TObject *Sender, TCloseAction *Action) {
      Action = TCloseAction::caFree;
    }


    Tokyo 10.2.2 Firemonkey下的模态窗口解决方案。

    https://community.embarcadero.com/blogs/entry/tdialogservice

    FMX.DialogService

      TDialogService.MessageDialog();
      TDialogService.InputQuery();

    TDialogService.ShowMessage('hello');

    复制代码
    procedure TForm2.btnShowMessageClick(Sender: TObject);
    begin
      TDialogService.ShowMessage('您点选了OK按钮', ShowMessageCloseMethod);
    end;
    
    procedure TForm2.ShowMessageCloseMethod(const AResult: TModalResult);
    var
      alvi : TListViewItem;
    begin
      alvi := ListView1.Items.Add;
      alvi.Text := DateTimeToStr(Now);
      alvi.Detail := '关闭了ShowMessage对话盒!';
    end;
    复制代码
     
  • 相关阅读:
    turtle库笔记
    使用turtle库绘制一个红色五角星图形‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪
    postgresql更新sequence的起始值
    es启动报错-系统设置
    mybatis批量update
    postgresql数据库连接数查询
    org.postgresql.util.PSQLException: 栏位索引超过许可范围:1,栏位数:0。
    postgresql创建SEQUENCE
    unzip解压所有zip格式
    jdk8中map的merge方法介绍
  • 原文地址:https://www.cnblogs.com/cb168/p/4874313.html
Copyright © 2011-2022 走看看