【问题标题】:Where is the "Modern looking SelectDirectory function"?“现代风格的 SelectDirectory 功能”在哪里?
【发布时间】:2021-09-18 01:00:53
【问题描述】:

此文档页面一直坚持认为存在“现代外观”的 SelectDirectory 函数。

https://www.embarcadero.com/products/rad-studio/windows-development?aldSet=en-GB

西雅图 10 号新品!外观现代的 SelectDirectory 函数。

在哪里可以找到?

如果我调用 FileCtrl.SelectDirectory 类似 Win3.1 的对话框弹出窗口:

这是新现代吗?还是我缺少“另一个” SelectDirectory 功能?

【问题讨论】:

  • (1) SelectDirectory 有两个重载,如 here 所述。一种是 Windows 3.1 风格,另一种是本机 Windows (95+) 对话框。 (2) 在现代桌面应用程序中,您应该使用标准的打开对话框来选择目录,如here 所述。 (3) 这些选项都早于西雅图,所以我不知道他们在说什么。
  • (但我一直认为基于打开对话框的方法有点不自然。例如,如果选择了一个目录并按 Enter 键,那么文件对话框肯定会导航到该目录目录?还是会像预期的那样调用“选择文件夹”按钮,因为它是带有粗蓝色边框的默认按钮,它将关闭对话框并“返回”这个选定的目录?还是会返回其父目录,即当前目录,而不是?)
  • 难道他们不能将函数命名为 SelectDirectoryEx 之类的其他名称吗?还是现代的?无论如何,正如你所说,仍然不现代......
  • 不,这还不够令人困惑。
  • @AndreasRejbrand - 谢谢。答案已接受。

标签: delphi


【解决方案1】:

自 Delphi 10 Seattle 以来,SelectDirectory 出现了第三次重载,并带有以下注释:

使用 IFileDialog 显示选择目录对话框(推荐在 Windows Vista 或更高版本)。

签名是:

function SelectDirectory(const StartDirectory: string; out Directories: TArray<string>; Options: TSelectDirFileDlgOpts = [];
  const Title: string = ''; const FolderNameLabel: string = ''; const OkButtonLabel: string = ''): Boolean; overload;

【讨论】:

  • 啊,所以它实际上与TFileOpenDialog 方法相同,但样板代码更少。
猜你喜欢
  • 1970-01-01
  • 2018-04-23
  • 2011-04-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多