在file-open-dialog中包括多选项选项

发布于 2025-02-06 20:23:28 字数 360 浏览 3 评论 0原文

为了允许在file-open-dialog中进行多键执行,并避免了这个长的表达式:

OpenDialogSourceFiles.Options := OpenDialogSourceFiles.Options + [Vcl.Dialogs.fdoAllowMultiSelect]; // works

我尝试使用较短的include函数:

System.Include(OpenDialogSourceFiles.Options, Vcl.Dialogs.fdoAllowMultiSelect);  // error

但是,编译器将其标记为错误。

To allow multiselection in a file-open-dialog and to avoid this long expression:

OpenDialogSourceFiles.Options := OpenDialogSourceFiles.Options + [Vcl.Dialogs.fdoAllowMultiSelect]; // works

I tried to use the shorter Include function:

System.Include(OpenDialogSourceFiles.Options, Vcl.Dialogs.fdoAllowMultiSelect);  // error

However, the compiler marks this as erroneous.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过期情话 2025-02-13 20:23:28

这是设计。 include过程需要一个变量作为其第一个参数(即使该过程是由编译器魔术实现的),但是tfileopendialog,即使该过程实现了var参数。选项是一个属性。

因此,您必须使用详细的替代方案。您无能为力。

例如,同一件事适用于inctcomponent.tag

(但是您可以编写fdoallowmultiselect而不是vcl.dialogs.fdoallowmultiselectinclude而不是system.include等使其少量详细。

This is by design. The Include procedure requires a variable as its first argument (it is a var parameter, essentially, even though the procedure is implemented by compiler magic), but TFileOpenDialog.Options is a property.

Hence you must use the verbose alternative. There's nothing you can do about it.

The same thing applies to Inc and TComponent.Tag, for instance.

(But you can write fdoAllowMultiSelect instead of Vcl.Dialogs.fdoAllowMultiSelect, Include instead of System.Include, etc. to make it a bit less verbose.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文