ShowModal在FireMonkey移动应用程序对话框
This is the only code that changes between the first and second code snippets:
dlg.ShowModal(procedure(ModalResult: TModalResult)
begin
if ModalResult = mrOK then
// if OK was pressed and an item is selected, pick it
if dlg.ListBox1.ItemIndex >= then
edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
dlg.DisposeOf;
end);
第一个代码片段:典型的代码调用的ShowModal
procedure THeaderFooterForm.btnPickClick(Sender: TObject);
var
dlg: TForm1;
begin
dlg := TForm1.Create(nil);
try
// select current value, if avaialble in the list
dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(edit1.Text); if dlg.ShowModal = mrOK then
// if OK was pressed and an item is selected, pick it
if dlg.ListBox1.ItemIndex >= then
edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
finally
dlg.Free;
end; end;
伪代码典型的ShowModal代码片段解读
这里是一个描述每个此过程的一部分:
声明局部变量
dlg: TForm1;
创建表格的形式和初始化成员
dlg := TForm1.Create(nil);
dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(edit1.Text);
显示的形式模态
if dlg.ShowModal = mrOK then
检查用户的结果和处理数据
if dlg.ListBox1.ItemIndex >= then
edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
释放表单 dlg.Free;
第二个代码片段:作为一个匿名的方式在所有平台上调用的ShowModal
随着移动平台,你应该改变这种代码,悦目,让所有支持的目标平台上工作的ShowModal。
procedure THeaderFooterForm.btnPickClick(Sender: TObject);
var
dlg: TForm1;
begin
dlg := TForm1.Create(nil);
// select current value, if available in the list
dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(edit1.Text); dlg.ShowModal(procedure(ModalResult: TModalResult)
begin
if ModalResult = mrOK then
// if OK was pressed and an item is selected, pick it
if dlg.ListBox1.ItemIndex >= then
edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
dlg.DisposeOf;
end); end;
匿名方法的ShowModal代码片段的伪代码解读
这里是一个描述发生了什么(做同样的事情,第一个代码段)在第二个代码片段:
Declare local variables
dlg: TForm1; Create form and initialize member in the form
dlg := TForm1.Create(nil);
dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(edit1.Text); Show the form modal
dlg.ShowModal(procedure(ModalResult: TModalResult) Check the user's result and process the data
if ModalResult = mrOK then
if dlg.ListBox1.ItemIndex >= then
edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex]; Free the form
dlg.DisposeOf;
ShowModal在FireMonkey移动应用程序对话框的更多相关文章
- Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序
http://cache.baiducontent.com/c?m=9d78d513d9d431a94f9d92697d60c015134381132ba1d0020fa48449e3732b4b50 ...
- VS 2008 创建MFC程序对话框的步骤
用过不少编程语言,可是刚开始学的时候最容易忘记一些简单的流程或者生疏了.那么这里就说说VS 2008 创建MFC程序对话框的步骤.我主要是android开发方面的.平时使用jni调用不少c++代码.所 ...
- xe5 firemonkey关闭应用程序
在FMX中,由Activity替代了Form的概念,虽然TForm类仍然存在,但MainForm通过关闭函数无法结束程序,使用Application.Terminate均无效,调整为: uses ...
- 小程序 模态对话框自定义组件(modal)
1. 概述 1.1 说明 小程序中使用wx.showModal(Object object)打开一个模态对话框,但是目前小程序所提供的modal中的内容显示比较死板,不能够完全满足工作中所遇到的功能信 ...
- Delphi for iOS开发指南(8):在iOS应用程序中使用Tab组件来显示分页
Delphi for iOS开发指南(8):在iOS应用程序中使用Tab组件来显示分页 在FireMonkey iOS应用程序中的Tab Tab由FMX.TabControl.TTabControl定 ...
- Delphi for iOS开发指南(6):在iOS应用程序中使用ComboBox组件来从列表中选择某一项
http://blog.csdn.net/delphiteacher/article/details/8924110 Delphi for iOS开发指南(6):在iOS应用程序中使用ComboBox ...
- Delphi for iOS开发指南(5):在iOS应用程序中使用Calendar组件来选择日期
http://blog.csdn.net/delphiteacher/article/details/8923519 在FireMonkey iOS应用程序中的Calendar FireMonkey使 ...
- [转]C# 应用程序安装部署步骤,安装前操作,先退出程序后卸载。
1. 点击[文件]-[新建]-[项目]-其他项目类型-安装和部署,选择安装项目,在下面的名称栏填写SetupTest(或者选择安装向导,一直点击[下一步])2. 安装项目----六个子项依次为:文件系 ...
- GTK+系统中的对话框(GTK+dialogs)
GTK+系统中的对话框(GTK+dialogs) GTK+系统中的对话框(GTK+ dialogs) 在接下来的章节中我们将着重介绍GTK+系统中的对话框. 对话框窗口是众多GUI应用程序中不可或缺的 ...
随机推荐
- android 动画属性(一)之Animation
Animation 在android 程序当中很多时候要用到动画效果,而动画效果主要是Animation来实现的,API给出的解释: 其中包含4种动画效果 AlphaAnimation 渐变透明度 R ...
- MVC的System.Web.Mvc.ViewPage小结
Inherits="System.Web.Mvc.ViewPage<dynamic>这一句最好是自己手动修改,如果是维护用户数据,用户对象名是User,改成Inherits=&q ...
- Libvirt 虚拟化库剖析
讲到向外扩展计算(比如云计算),libvirt 可能是您从未听说过的最重要的库之一.libvirt 提供一种虚拟机监控程序不可知的 API 来安全管理运行于主机上的来宾操作系统.libvirt 本身不 ...
- 查看系统和PowerShell版本
查询PowerShell当前版本$psversiontable.BuildVersion.Major 查询Windows当前版本:[System.Environment]::OSVersion.Ver ...
- MiinCMP1.0 SAE 新浪云版公布, 开源企业站点系统
MiinCMP是一款开源企业站点系统,除可执行于256M左右100元的国内IDC外,JUULUU聚龙软件团队最近开发了面向新浪云的版本号,该版本号可将站点免费布署到新浪云SAE上.MiinCMP採用j ...
- Codeforces Round #335 (Div. 2) A. Magic Spheres 水题
A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...
- uva 387 A Puzzling Problem (回溯)
A Puzzling Problem The goal of this problem is to write a program which will take from 1 to 5 puzz ...
- alue of type java.lang.String cannot be converted to JSONObject
/** * 4.0以下系统处理掉返回json的BOM头 * * @param jsonStr * @return */ public static String getJson(String json ...
- WebService究竟是什么?
一.序言 大家或多或少都听过WebService(Web服务),有一段时间非常多计算机期刊.书籍和站点都大肆的提及和宣传WebService技术,当中不乏非常多吹嘘和做广告的成分.可是不得不承认的是W ...
- sqlserver2008 复制,镜像,日志传输及故障转移集群区别
一, 数据库复制 SQL Server 2008数据库复制是通过发布/订阅的机制进行多台服务器之间的数据同步,我们把它用于数据库的同步备份.这里的同步备份指的是备份服务器与主服务器进行 实时数据同步, ...