FMXUI - UI.Dialog 示例
在 FMXUI 开源库,增加了 UI.Dialog 单元。此单元实现了跨平台的基础对话框组件。使用时引用 UI.Dialog 即可。如果需要自定义对话框的样式, 可以添加一个 TDialogStyleManager 组件在主窗体中。
GIT: https://github.com/yangyxd/FMXUI
对话框效果演示图(默认样式,Windows平台):
此 Demo 已经包含在源码库中,主要代码如下:

uses
UI.Dialog, UI.Async; { TFrmaeDialog } procedure TFrmaeDialog.ButtonView1Click(Sender: TObject);
begin
TDialogBuilder.Create(Self)
.SetMessage('我是一个消息框。')
.Show;
end; procedure TFrmaeDialog.ButtonView2Click(Sender: TObject);
begin
TDialogBuilder.Create(Self)
.SetMessage('我是一个消息框。这里显示消息内容')
.SetNegativeButton('Negative',
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Dialog.Builder.NegativeButtonText);
end
)
.SetNeutralButton('Neutral',
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Dialog.Builder.NeutralButtonText);
end
)
.SetPositiveButton('Positive',
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Dialog.Builder.PositiveButtonText);
end
)
.Show;
end; procedure TFrmaeDialog.ButtonView3Click(Sender: TObject);
begin
TDialogBuilder.Create(Self)
.SetTitle('我是标题文本')
.SetMessage('我是一个消息框。这里显示消息内容')
.SetNegativeButton('Negative',
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Dialog.Builder.NegativeButtonText);
end
)
.SetPositiveButton('Positive',
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Dialog.Builder.PositiveButtonText);
end
)
.Show;
end; procedure TFrmaeDialog.ButtonView4Click(Sender: TObject);
begin
TDialogBuilder.Create(Self)
.SetTitle('我是标题文本')
.SetItems(['列表项 - 1', '列表项 - 2', '列表项 - 3', '列表项 - 4', '列表项 - 5'],
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Dialog.Builder.ItemArray[Which]);
end
)
.Show;
end; procedure TFrmaeDialog.ButtonView5Click(Sender: TObject);
begin
TDialogBuilder.Create(Self)
.SetTitle('我是标题文本')
.SetSingleChoiceItems(['列表项 - 1', '列表项 - 2', '列表项 - 3', '列表项 - 4', '列表项 - 5'], 1)
.SetPositiveButton('取消')
.SetNegativeButton('确定',
procedure (Dialog: IDialog; Which: Integer) begin
Hint('选择了: ' + Dialog.Builder.ItemArray[Dialog.Builder.CheckedItem]);
end
)
.Show;
end; procedure TFrmaeDialog.ButtonView6Click(Sender: TObject);
begin
TDialogBuilder.Create(Self)
.SetTitle('我是标题文本')
.SetMultiChoiceItems(['列表项 - 1', '列表项 - 2', '列表项 - 3', '列表项 - 4', '列表项 - 5'], [])
.SetPositiveButton('取消')
.SetNegativeButton('确定',
procedure (Dialog: IDialog; Which: Integer) begin
Hint(Format('选择了 %d 项.', [Dialog.Builder.CheckedCount]));
end
)
.Show;
end; procedure TFrmaeDialog.ButtonView7Click(Sender: TObject);
begin
ShowWaitDialog('正在执行任务...', False);
TAsync.Create()
.SetExecute(
procedure (Async: TAsync) begin
Sleep(3000);
end
)
.SetExecuteComplete(
procedure (Async: TAsync) begin
HideWaitDialog;
end
).Start;
end; procedure TFrmaeDialog.ButtonView8Click(Sender: TObject);
begin
ShowWaitDialog('正在执行任务...',
procedure (Dialog: IDialog) begin
Hint('任务被取消');
end
);
TAsync.Create()
.SetExecute(
procedure (Async: TAsync) begin
Sleep(5000);
end
)
.SetExecuteComplete(
procedure (Async: TAsync) begin
if not IsWaitDismiss then // 如果任务没有被中断
Hint('任务执行完成.');
HideWaitDialog;
end
).Start;
end; procedure TFrmaeDialog.DoShow;
begin
inherited;
tvTitle.Text := Title;
end; procedure TFrmaeDialog.SpeedButton1Click(Sender: TObject);
begin
Finish;
end;

http://www.cnblogs.com/yangyxd/articles/5877638.html
FMXUI - UI.Dialog 示例的更多相关文章
- FMXUI - UI.Dialog 示例(比较漂亮)
在 FMXUI 开源库,增加了 UI.Dialog 单元.此单元实现了跨平台的基础对话框组件.使用时引用 UI.Dialog 即可.如果需要自定义对话框的样式, 可以添加一个 TDialogStyle ...
- jQuery UI dialog 参数说明
前段时间碰到个问题 jquery UI dialog弹出层 弹出多个层是 比如弹出两个层A和B B层如果显示的数据表格太大,伸到了A层的外面,那伸到A层之外的部分就看不到了,因为B层是在A层上弹出的 ...
- js插件---Amaze UI dialog如何使用
js插件---Amaze UI dialog如何使用 一.总结 一句话总结:别人给你列出来的参考手册照着用先 1.在哪里去找插件参考资料或者使用手册(一般位置找不到的时候)? github上面啊,非常 ...
- 解决Select2控件不能在jQuery UI Dialog中不能搜索的bug
本文使用博客园Markdown编辑器进行编辑 1.问题呈现 项目中使用了jQuery UI的Dialog控件,一般用来处理需要提示用户输入或操作的简单页面.逻辑是修改一个广告的图片和标题. 效果截图如 ...
- [转]jQuery UI Dialog Modal Popup Yes No Confirm example in ASP.Net
本文转自:http://www.aspsnippets.com/Articles/jQuery-UI-Dialog-Modal-Popup-Yes-No-Confirm-example-in-ASPN ...
- API分析——Jquery UI Dialog
1.阅读API文档的一般方法? 通常地, API由三部分构成:属性.方法.事件. 属性表示参数配置,作为一个组件的微调,或者功能的开启与关闭: 方法表示组件能够发生的动作,或者组件的状态监测: 事件表 ...
- jQuery UI dialog 的使用
今天用到了客户端的对话框,把 jQuery UI 中的对话框学习了一下. 准备 jQuery 环境 首先,我们创建一个按钮,点击这个按钮的时候,将会弹出一个对话框. 1 <input type= ...
- jQuery UI dialog 參数说明
前段时间碰到个问题 jquery UI dialog弹出层 弹出多个层是 比方弹出两个层A和B B层假设显示的数据表格太大,伸到了A层的外面,那伸到A层之外的部分就看不到了,由于B层是在A层上弹出的 ...
- Jquery - UI - Dialog(转)
jQuery UI Dialog常用的参数有: 1.autoOpen:默认true,即dialog方法创建就显示对话框 2.buttons:默认无,用于设置显示的按钮,可以是JSON和Array形式: ...
随机推荐
- Nginx 之三:nginx服务器模块、web请求处理机制及事件驱动模型、进程功能和进程间通信
一:Nginx的模块化结构设计: 1.核心模块:指的是nginx服务器运行当中必不可少的模块,这些模块提供了最基本最核心的服务,比如权限控制.进程管理.错误日志.事件驱动.正则表达式解析等,nginx ...
- python collections.Counter笔记
Counter是dict的子类,所以它其实也是字典.只不过它的键对应的值都是计数,值可以是任意整数.下面是四种创建Counter实例的例子: >>> c = Counter() # ...
- (Problem 22)Names scores
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-tho ...
- Outlook Anywhere 每次要输入密码
客户端加入域Exchange OutlookAnywhere使用NTLM验证 2007 2010:
- c++继承构造子类调用父类构造函数的问题及关于容器指针的问题及当容器里储存指针时,记得要手动释放
看下面的一个问题: class Person { private: string name; public: Person(const string& s=""){ nam ...
- 「操作系统」:Linker Use static Libraries
While static libraries are useful and essential tools, they are also a source of confusion to progra ...
- java学习之字符流与字节流的转换
package com.io; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundExce ...
- JAVA中IO和异常处理练习
1.SystemI\O练习:1)通过键盘输入若干字符,并通过显示器输出:2)定义一个静态方法validOrNot()用于对输入的字符进行合法性校验,若包含非英文字符,则抛出IllegalStringE ...
- paip.tree 生成目录树到txt后的折叠查看
paip.tree 生成目录树到txt后的折叠查看 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.ne ...
- Cloud Foundry中warden的网络设计实现——iptable规则配置
在Cloud Foundry v2版本号中,该平台使用warden技术来实现用户应用实例执行的资源控制与隔离. 简要的介绍下warden,就是dea_ng假设须要执行用户应用实例(本文暂不考虑ward ...