博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FMX 模态窗体
阅读量:7092 次
发布时间:2019-06-28

本文共 2943 字,大约阅读时间需要 9 分钟。

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 interface, and define a function to handle the closing of your dialog box:
class TModalFormCallback : public TCppInterfacedObject
> { 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 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;
 

转载地址:http://fuiql.baihongyu.com/

你可能感兴趣的文章
查询是谁在用挂载的硬盘
查看>>
JavaScript之number类型的数值转换成某某进制
查看>>
iptables从入门到放弃
查看>>
PHP函数中默认参数的的写法
查看>>
Linux TCP/IP网络管理工具:net-tools VS iproute2
查看>>
linux
查看>>
CentOS6.5+Puppet3.7.3 安装、配置及测试
查看>>
grep、egrep及相应的正则表达式和用法
查看>>
Oracle修改数据文件名/移动数据文件
查看>>
Oracle内部错误:ORA-00600[17175]一例
查看>>
GATHER_STATS_JOB: Stopped by Scheduler. Consider increasing the maintenance window duration if this
查看>>
linux和windows下的clock函数
查看>>
seq命令
查看>>
JsonUtils 工具类
查看>>
shell 编写脚本批量ping ip
查看>>
MySQL5.6在线表结构变更(online ddl)总结
查看>>
人人都能学编程
查看>>
redis3.0.0 集群安装详细步骤
查看>>
31 天重构学习笔记22. 分解方法
查看>>
java:“泛型”的前世今生
查看>>