在 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. width:100%和width:inherit

    前几天遇到过这么一个问题.我想让子盒子的宽度等于父盒子的宽度.父盒子宽度为一个具体值比如说200px.我将子盒子宽度设为了100%.按道理说应该是可以等于父盒子的宽度的,但结果并没有,而是通栏了.然后 ...

  2. python画最最简单的折线图

    # encoding=utf-8import matplotlib.pyplot as pltfrom pylab import * #支持中文mpl.rcParams['font.sans-seri ...

  3. [TypeStyle] Add responsive styles using TypeStyle Media Queries

    Media queries are very important for designs that you want to work on both mobile and desktop browse ...

  4. 使用openoffice转换ms_office to pdf

    java源代码: package com.jeecms.common.office2pdf; import java.io.File; import java.io.FileInputStream; ...

  5. Android面试准备 第二天 第五例 数据存储

    參考:http://blog.csdn.net/lmj623565791/article/details/24015867 5.Activity用SharedPreferences保存数据,大小有木有 ...

  6. Java NIO详细介绍

    不错的文章,推荐一下. http://www.ibm.com/developerworks/cn/education/java/j-nio/j-nio.html JavaNIO非堵塞技术实际是采取Re ...

  7. Linux下使用Python的Tkinter库出现的No module named _tkinter问题

    这是由于python的版本没有包含tkinter的模块,只需要把tk的package安装就可以了. 一般在linux才出现,windows版本一般已经包含了tkinter模块.

  8. POJ 3252 Round Numbers(数位dp&amp;记忆化搜索)

    题目链接:[kuangbin带你飞]专题十五 数位DP E - Round Numbers 题意 给定区间.求转化为二进制后当中0比1多或相等的数字的个数. 思路 将数字转化为二进制进行数位dp,由于 ...

  9. php如何利用标准输入输出实现在一个字符串中计算某个字符出现的个数?

    php如何利用标准输入输出实现在一个字符串中计算某个字符出现的个数? 一.总结 php实现计算字符个数(php标准输入和输出:fgets(STDIN)  echo $output;) 1.php标准输 ...

  10. 浏览器对象模型bom的作用是什么?

    浏览器对象模型bom的作用是什么? 零.总结 1.BOM提供了独立于内容而与浏览器窗口进行交互的对象 2.BOM提供了一些访问窗口对象的一些方法,我们可以用它来移动窗口位置,改变窗口大小,打开新窗口和 ...