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;

FMX 模态窗体的更多相关文章
- VB6关于判断模态窗体的问题
模态窗体也有人叫模式窗体,是否为模态窗体由Show方法的参数决定: 语法 object.Show style, ownerform Show 方法的语法包含下列部分: 部分 描述 object 可选的 ...
- delphi模态窗体最小化会隐藏的问题
在使用delphi创建模态窗体的时候最小化窗体会导致最小化的窗体不可见,再次点击主窗体才会显示. 在这个模态窗体中增加以下函数 procedure WmSysCommand(var msg: TMes ...
- 游戏UI框架设计(四) : 模态窗体管理
游戏UI框架设计(四) --模态窗体管理 我们在开发UI窗体时,对于"弹出窗体"往往因为需要玩家优先处理弹出小窗体,则要求玩家不能(无法)点击"父窗体",这种窗 ...
- 关于DatePicker在模态窗体下失效的问题
最近用bootstrap做了一个租赁相关的管理系统,由于前端知识薄弱,也是编查资料边做.关于一些控件的用法,也是从网上查资料.下面,来说一下在写前端页面时遇到的几个坑. 这个系统中,日期控件用的是Da ...
- Sharepoint模态窗体(实战)
分享人:广州华软 无名 一. 前言 对SharePoint二次开发时,需要知道SharePoint有什么.没有什么,才能在开发过程中避免重复造轮子.SharePoint提供了许多开箱即用的功能,这次要 ...
- 自制模态窗体闪烁效果: MessageBeep & FlashWindowEx
SetFocus(hwnd_frame_preview); //设置焦点 /** 模拟模态窗口动作 **/ MessageBeep(0xFFFFFFFF); //0xFFFFFFFF SystemDe ...
- Delphi: 模态窗体最小化
源起: 近期所介入的几个项目中,最后视频生成窗体,为一模态对话框.因生成时间可能较长,所以其窗体可以最小化,它最小化时同时最小化主程序,唤醒时主程序再复原. 代码亦是8年前本人所写,一直那样用了,也没 ...
- Qt无边框窗体-模拟模态窗体抖动效果
目录 一.概述 二.效果展示 三.功能实现 四.相关文章 原文链接:Qt无边框窗体-模拟模态窗体抖动效果 一.概述 用Qt开发windows客户端界面确实是一大利器,兼顾性能的同时,速度相对来说也不错 ...
- Electron基础 - 如何创建模态窗体
在开发桌面端应用我们常常需要弹出一个提示窗体或者对话框,而提示窗体和对话框和普通窗体的区别是,在提示框出现时,其它窗体就被锁定了,必须要等到提示框被正确关闭时其它窗体才能“解锁”,这种类型的窗体叫做模 ...
随机推荐
- 通过yum安装mysql
在linux中安装数据库首选MySQL,Mysql数据库的第一个版本就是发行在Linux系统上,其他选择还可以有postgreSQL,oracle等 在Linux上安装mysql数据库,我们可以去其官 ...
- mysqli得到记录数量
$result = $conn->query($sql);$result->num_rows;
- review34
Thread类与线程的创建 让线程启动时使用我们自己创建run()的两种方式:一种是继承Thread类,实现其中的run()方法,然后用继承的类用无参构造方法创建对象就可以了.第二种是实现Runnab ...
- iis 设置 主机头,设置 host文件
iis主机头设置后,一般本机不能再用ip:127.0.0.1访问. 接着设置host文件,使用域名直接访问主机头就可以访问到127.0.0.1 host文件路径:c//system32/drives/ ...
- Xcode 查找 TODO 清单
在 Xcode 中按 Shift+Command+F,显示在项目中查找窗口,选择按正则表达式查找(Find > Regular Expression): TODO: //\s*\bTODO\s ...
- 不一样的控制面板 GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
这是一个快速打开所有控制面板选项的方法.被称作Gode Mode或者Master Control Panel. 步骤很简单: 复制:超级控制面板.{ED7BA470-8E54-465E-825C-99 ...
- iOS 检查指定日期是否在当前日期之前
iOS检查指定日期是否在当前日期之前, 直接上代码: - (BOOL)checkProductDate: (NSString *)tempDate { NSDateFormatter *dateFor ...
- oralce 索引(2)
B-Tree 索引 本文来自网上整理 来自以下博客内容 http://www.360doc.com/content/13/0712/11/13136648_299364992.shtml; http: ...
- vue-router使用next()跳转到指定路径时会无限循环
我在路由为 /path 的页面这样写 beforeRouteLeave (to, from, next) { console.log('离开路路由') if(to.fullPath==='/home' ...
- MySQL学习之一数据库简介
1.什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库,长期储存在计算机内.有组织的.可共享的数据集合. 数据库中的数据指的是以一定的数据模型组织.描述和储存在一起. ...