在 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 示例(比较漂亮)的更多相关文章

  1. FMXUI - UI.Dialog 示例

    在 FMXUI 开源库,增加了 UI.Dialog 单元.此单元实现了跨平台的基础对话框组件.使用时引用 UI.Dialog 即可.如果需要自定义对话框的样式, 可以添加一个 TDialogStyle ...

  2. jQuery UI dialog 参数说明

    前段时间碰到个问题 jquery UI dialog弹出层 弹出多个层是 比如弹出两个层A和B  B层如果显示的数据表格太大,伸到了A层的外面,那伸到A层之外的部分就看不到了,因为B层是在A层上弹出的 ...

  3. js插件---Amaze UI dialog如何使用

    js插件---Amaze UI dialog如何使用 一.总结 一句话总结:别人给你列出来的参考手册照着用先 1.在哪里去找插件参考资料或者使用手册(一般位置找不到的时候)? github上面啊,非常 ...

  4. 解决Select2控件不能在jQuery UI Dialog中不能搜索的bug

    本文使用博客园Markdown编辑器进行编辑 1.问题呈现 项目中使用了jQuery UI的Dialog控件,一般用来处理需要提示用户输入或操作的简单页面.逻辑是修改一个广告的图片和标题. 效果截图如 ...

  5. [转]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 ...

  6. API分析——Jquery UI Dialog

    1.阅读API文档的一般方法? 通常地, API由三部分构成:属性.方法.事件. 属性表示参数配置,作为一个组件的微调,或者功能的开启与关闭: 方法表示组件能够发生的动作,或者组件的状态监测: 事件表 ...

  7. jQuery UI dialog 的使用

    今天用到了客户端的对话框,把 jQuery UI 中的对话框学习了一下. 准备 jQuery 环境 首先,我们创建一个按钮,点击这个按钮的时候,将会弹出一个对话框. 1 <input type= ...

  8. jQuery UI dialog 參数说明

    前段时间碰到个问题 jquery UI dialog弹出层 弹出多个层是 比方弹出两个层A和B  B层假设显示的数据表格太大,伸到了A层的外面,那伸到A层之外的部分就看不到了,由于B层是在A层上弹出的 ...

  9. Jquery - UI - Dialog(转)

    jQuery UI Dialog常用的参数有: 1.autoOpen:默认true,即dialog方法创建就显示对话框 2.buttons:默认无,用于设置显示的按钮,可以是JSON和Array形式: ...

随机推荐

  1. [Angular HTML] Overwrite input value, String.fromCharCode & input.selectionStart

    @HostListener('keydown', ['$event', '$event.keyCode']) onKeyDown($event: KeyboardEvent, keyCode) { i ...

  2. 关于stm32的输入输出

    https://blog.csdn.net/u011556018/article/details/72629082

  3. redis 的惊群处理和分布式锁的应用例子

    在并发量比较高的情况下redis有很多应用场景,提升查询效率,缓解底层DBio ,下面列举两个平时开发中应用过的两个例子,欢迎各位一起讨论改进. 1 . redis 惊群处理 1.1 方案的由来 Re ...

  4. 【32.22%】【codeforces 602B】Approximating a Constant Range

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  5. hdu 1166 敌兵布阵 线段树 点更新

    // hdu 1166 敌兵布阵 线段树 点更新 // // 这道题裸的线段树的点更新,直接写就能够了 // // 一直以来想要进线段树的坑,结果一直没有跳进去,今天算是跳进去吧, // 尽管十分简单 ...

  6. ios开发网络学习三:NSURLConnection小文件大文件下载

    一:小文件下载 #import "ViewController.h" @interface ViewController ()<NSURLConnectionDataDele ...

  7. ASP.Net WebAPI HttpDelete/PUT方法运行或发布到生产服务器上后出现405(Method Not Allowed)错误的解决办法

    原文:ASP.Net WebAPI HttpDelete/PUT方法运行或发布到生产服务器上后出现405(Method Not Allowed)错误的解决办法 本文只是个人的理解和学习记录,如果觉得本 ...

  8. 【9207&&b701】统计数字(NOIP2007)

    问题描述 某次科研调查时得到了n个自然数,每个数均不超过1500000000 (1.5*109).已知不相同的数不超过10000个,现在需要统计这些自然数各自出现的次数,并按照自然数从小到大的顺序输出 ...

  9. 【38.24%】【POJ 1201】Intervals

    Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 25902 Accepted: 9905 Description You are ...

  10. 【LeetCode-面试算法经典-Java实现】【107-Binary Tree Level Order Traversal II(二叉树层序遍历II)】

    [107-Binary Tree Level Order Traversal II(二叉树层序遍历II)] [LeetCode-面试算法经典-Java实现][全部题目文件夹索引] 原题 Given a ...