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;
 

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. pandas的Series

    pandas.Series(data=None, index=None, dtype=None, name=None, copy=False, fastpath=False) 首先介绍一下基本的: d ...

  2. Memcache简介 & 内存分配机制

            关于这个东西里面到底应该存放数据网上一直有很多种说法,有的说sql进行md5之后作为键值,结果作为内容存放,也有人说按照业务逻辑错放,反正是炒的不亦乐乎.        本人经过将近2 ...

  3. unity调用C++ dll文件

    首先建立Plugins文件夹,把dll文件放在里面 一一对应,我踩的坑是文件名加了后缀.dll,虽然不知道网上为什么都加了我这加了就报找不到dll文件错误,反正解决啦

  4. wpf多程序集之间共享资源字典--CLR名称空间未定义云云

    wpf多程序集之间共享资源字典--CLR名称空间未定义云云 分类: WPF 2012-10-28 10:57 1162人阅读 评论(0) 收藏 举报 以下介绍如何创建可用于在多个程序集之间共享的资源字 ...

  5. propertychange 属性说明

    propertychange(ie)和input事件 input是标准的浏览器事件,一般应用于input元素,当input的value发生变化就会发生,无论是键盘输入还是鼠标粘贴的改变都能及时监听到变 ...

  6. The import javax.servlet.jsp.JspWriter cannot be resolved' error

    Add servlet-api.jar and jsp-api.jar from Tomcat 6.0 library to ecipse project.

  7. SQL1221N The Application Support Layer heap cannot be allocated. SQLSTATE=57011

    不能分配“应用程序支持层“堆 内存不足(系统中可用的调页空间量或交换空间量或系统中可用的物理内存量),可能会导致问题,并提示如下错误信息: SQL1221N  The Application Supp ...

  8. jquery判断密码是否一致?

    密码 请输入密码 重新输入密码 请输入新密码 <input type="text" id="btn0"> 密码 <span class=&qu ...

  9. codeforces D. Area of Two Circles' Intersection 计算几何

    D. Area of Two Circles' Intersection time limit per test 2 seconds memory limit per test 256 megabyt ...

  10. Codeforces Round #246 (Div. 2) C. Prime Swaps(贪心,数论)

    题目链接:http://codeforces.com/contest/432/problem/C 首先由题意分析出:这些数是从1到n且各不相同,所以最后结果肯定是第i位的数就是i. 采用这样一种贪心策 ...