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:

  1. procedure MyCurrentForm.MyButtonClick(Sender: TObject);
  2. var
  3. dlg: TMyModalForm;
  4. begin
  5. // Create an instance of a form.
  6. dlg := TMyModalForm.Create(nil);
  7.  
  8. // Configure the form. For example, give it a display name.
  9. dlg.Caption := 'My Modal Dialog Box';
  10.  
  11. // Show your dialog box and provide an anonymous method that handles the closing of your dialog box.
  12. dlg.ShowModal(
  13. procedure(ModalResult: TModalResult)
  14. begin
  15. // Do something.
  16. end
  17. );
  18. end;

C++:

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

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:

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

C++:

  1. void __fastcall TMyModalForm::FormClose(TObject *Sender, TCloseAction *Action) {
  2. Action = TCloseAction::caFree;
  3. }
  4.  

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

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

FMX.DialogService

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

TDialogService.ShowMessage('hello');

  1. procedure TForm2.btnShowMessageClick(Sender: TObject);
  2. begin
  3. TDialogService.ShowMessage('您点选了OK按钮', ShowMessageCloseMethod);
  4. end;
  5.  
  6. procedure TForm2.ShowMessageCloseMethod(const AResult: TModalResult);
  7. var
  8. alvi : TListViewItem;
  9. begin
  10. alvi := ListView1.Items.Add;
  11. alvi.Text := DateTimeToStr(Now);
  12. alvi.Detail := '关闭了ShowMessage对话盒!';
  13. end;
  1.  

FMX 模态窗体的更多相关文章

  1. VB6关于判断模态窗体的问题

    模态窗体也有人叫模式窗体,是否为模态窗体由Show方法的参数决定: 语法 object.Show style, ownerform Show 方法的语法包含下列部分: 部分 描述 object 可选的 ...

  2. delphi模态窗体最小化会隐藏的问题

    在使用delphi创建模态窗体的时候最小化窗体会导致最小化的窗体不可见,再次点击主窗体才会显示. 在这个模态窗体中增加以下函数 procedure WmSysCommand(var msg: TMes ...

  3. 游戏UI框架设计(四) : 模态窗体管理

    游戏UI框架设计(四) --模态窗体管理 我们在开发UI窗体时,对于"弹出窗体"往往因为需要玩家优先处理弹出小窗体,则要求玩家不能(无法)点击"父窗体",这种窗 ...

  4. 关于DatePicker在模态窗体下失效的问题

    最近用bootstrap做了一个租赁相关的管理系统,由于前端知识薄弱,也是编查资料边做.关于一些控件的用法,也是从网上查资料.下面,来说一下在写前端页面时遇到的几个坑. 这个系统中,日期控件用的是Da ...

  5. Sharepoint模态窗体(实战)

    分享人:广州华软 无名 一. 前言 对SharePoint二次开发时,需要知道SharePoint有什么.没有什么,才能在开发过程中避免重复造轮子.SharePoint提供了许多开箱即用的功能,这次要 ...

  6. 自制模态窗体闪烁效果: MessageBeep & FlashWindowEx

    SetFocus(hwnd_frame_preview); //设置焦点 /** 模拟模态窗口动作 **/ MessageBeep(0xFFFFFFFF); //0xFFFFFFFF SystemDe ...

  7. Delphi: 模态窗体最小化

    源起: 近期所介入的几个项目中,最后视频生成窗体,为一模态对话框.因生成时间可能较长,所以其窗体可以最小化,它最小化时同时最小化主程序,唤醒时主程序再复原. 代码亦是8年前本人所写,一直那样用了,也没 ...

  8. Qt无边框窗体-模拟模态窗体抖动效果

    目录 一.概述 二.效果展示 三.功能实现 四.相关文章 原文链接:Qt无边框窗体-模拟模态窗体抖动效果 一.概述 用Qt开发windows客户端界面确实是一大利器,兼顾性能的同时,速度相对来说也不错 ...

  9. Electron基础 - 如何创建模态窗体

    在开发桌面端应用我们常常需要弹出一个提示窗体或者对话框,而提示窗体和对话框和普通窗体的区别是,在提示框出现时,其它窗体就被锁定了,必须要等到提示框被正确关闭时其它窗体才能“解锁”,这种类型的窗体叫做模 ...

随机推荐

  1. mysqli得到记录数量

    $result = $conn->query($sql);$result->num_rows;

  2. js的事件处理与闭包:

    var i = 0; for(i=0;i<5;i++){ (function(i){ setTimeout(function(){alert(i)},3000); })(i) } // 上面打印 ...

  3. java:file文件类

    public class FileDemo { public static File file; public static void main(String args[]) { String s = ...

  4. Mssql 跨域查询

    有数据库test1和数据库test2.其中test1中有表 table1.table2:test2 中有表 table1.三个表的字段都为为:id.xingming.shijian.shuliang. ...

  5. 解决:python命令行运行出错 ImportError: No module named ...

    一. 发现问题 今天在cmd命令行运行一个py文件,本来在pycharm中运行好好的文件,在命令行却报错了,直接提示我:ImportError: No module named 'homeworks' ...

  6. 解决:Eclipse安装Pydev插件报错: An error occurred while collecting items to be installed session context was:(profile=...

    今天在Elipse上安装Pydev插件时报错: An error occurred while collecting items to be installed session context was ...

  7. MinGW main()

    MinGW没有wmain入口函数,为了获取宽字符的参数,可以用系统API函数GetCommandLineW. main.cpp #include <iostream> #include & ...

  8. ural 2013 Neither shaken nor stirred

    2013. Neither shaken nor stirred Time limit: 1.0 secondMemory limit: 64 MB The ACM ICPC regional con ...

  9. nyojb 2359 巴什博弈变形

    http://acm.nyist.me/JudgeOnline/problem.php?id=2359 2359: 巴什博弈? 时间限制: 1 Sec  内存限制: 30 MB提交: 237  解决: ...

  10. selenium-webdirver api-定位方式

    1,8种单数定位方式 # 通过ID定位目标元素 driver.find_element_by_id('i1') # 通过className定位目标元素 driver.find_element_by_c ...