TTaskDialog/zh CN
From Free Pascal wiki
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
│
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
中文(中国大陆) (zh_CN) │
TTaskDialog 是不可见控件, 运行时会显示完整的对话框, 具有 Windows TaskDialog API 的功能. 在 Dialogs tab 的 Component Palette. Lazarus 1.8以后包含此控件.
调用方法:Execute(), 假如获得 True, 属性 ModalResult 具有如下:
- 标准按钮 (OK, Cancel, Yes 等)
- 自定义, 在ModalResult中详细指定
假如窗口成功打开则返回True. 对话框无法为不同参数显示对话框, 这种情况下就不执行,则返回False.
属性 MainIcon 可以设置弹窗对应的图标 : none, warning, error, information, shield.
属性 RadioButton 有单选按钮对象。
样例
This example shows how to create dialog in runtime, and to add custom buttons in runtime:
with TTaskDialog.Create(self) do
try
Title := 'Confirm removal';
Caption := 'Confirm';
Text := 'Remove selected item?';
CommonButtons := [];
with TTaskDialogButtonItem(Buttons.Add) do
begin
Caption := 'Remove';
ModalResult := mrYes;
end;
with TTaskDialogButtonItem(Buttons.Add) do
begin
Caption := 'Keep';
ModalResult := mrNo;
end;
MainIcon := tdiQuestion;
if Execute then
if ModalResult = mrYes then
ShowMessage('Item removed');
finally
Free;
end
参考资料