维基副本镜像

这是 pascal.chat 维基的镜像。编辑、历史记录和登录都在那里。

TTaskDialog/zh CN

English · Français · Suomi · Русский · 中文(中国)

TTaskDialog 是不可见控件, 运行时会显示完整的对话框, 具有 Windows TaskDialog API 的功能. 在 Dialogs tab 的 Component Palette. Lazarus 1.8以后包含此控件.

调用方法:Execute(), 假如获得 True, 属性 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:

pascal
  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

参考资料


From the Free Pascal wiki, page "TTaskDialog/zh CN", as it stood on 2020-05-03 after a change by TyphonFinger, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

版本1,最后由WikiArchive于修改。