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基础 - 如何创建模态窗体
在开发桌面端应用我们常常需要弹出一个提示窗体或者对话框,而提示窗体和对话框和普通窗体的区别是,在提示框出现时,其它窗体就被锁定了,必须要等到提示框被正确关闭时其它窗体才能“解锁”,这种类型的窗体叫做模 ...
随机推荐
- UOJ283 直径拆除鸡
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...
- Linux上SFTP用法
SFTP简介 sftp是一个交互式的文件传输协议,类似于ftp,但它进行加密传输,比ftp更安全. SFTP用法 localhost 从远程主机获取文件或目录到本地目录下 sftp>get /h ...
- Windows环境下CGAL的安装
1 准备工作 下载cmake 下载CGAL安装包 学习如何设置环境变量 安装Qt运行demos. libQGLViewer用来运行 3D CGAL demos. 确定Visual Studio 相应的 ...
- 按键(ESC ,F1,F2等)——wpf的命令处理方法
WPF窗体的命令绑定 方法一:使用代码 <WpfUI:View.CommandBindings> <CommandBinding Command="Help" ...
- 1001 字符串“水”题(二进制,map,哈希)
1001: 字符串“水”题 时间限制: 1 Sec 内存限制: 128 MB提交: 210 解决: 39[提交][状态][讨论版] 题目描述 给出一个长度为 n 的字符串(1<=n<= ...
- axure下载及汉化
第一步:下载axure rp 6.5英文原版 axure6.5官方英文下载地址: Windows版:http://t.cn/zW7JifS 第二步:安装汉化语言包 axure6.5汉化语言包中文包下载 ...
- 【VS2013生成DirectX Tutorials时遇到的错误】无法解析的外部符号 _D3D10CreateDeviceAndSwapChain@32
本文为大便一箩筐的原创内容,转载请注明出处,谢谢:http://www.cnblogs.com/dbylk/p/3696472.html 今天尝试编译DirectX10中的一个Turorials时, ...
- ionic2——apk签名
1.签名的意义 为了保证每个应用程序开发商合法ID,防止部分开放商可能通过使用相同的Package Name来混淆替换已经安装的程序,我们需要对我们发布的APK文件进行唯一签名,保证我们每次发布的版本 ...
- oracle后台进程简介
一:database write--数据写入 DBWR 作用:把SGA中被修改的数据同步到磁盘文件中.保证Buffer Cache中有足够的空闲数据块数量. PS:如果LGWR出现故障, ...
- hdoj-1106-排序(stringstream)
题目链接 /* Name: Copyright: Author: Date: 2018/5/2 20:56:53 Description: */ #include <iostream> # ...