如何将“查找”对话框中的文本框(编辑)更改为Delphi中的ComboBox?

发布于 2025-02-13 10:40:25 字数 251 浏览 0 评论 0 原文

我目前在我的delphi应用程序中使用标准 tfinddialog

img src =“ https://i.sstatic.net/fqzux.jpg”

< combobox的文本框?我想设置它,以便用户可以轻松地从历史记录中看到和选择:

“查找对话模型”使用Combobox“

I currently use a standard TFindDialog in my Delphi application:

default Find dialog

How can I change the textbox to a combobox? I'd like to set it up so that the user can easily see and select from the history, like this:

mockup of Find dialog with combobox

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

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

发布评论

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

评论(1

苍风燃霜 2025-02-20 10:40:25

我目前在我的Delphi应用程序中使用标准finddialog。

如何将文本框更改为组合框?

您至少不能使用 tfinddialog ,因为它不允许使用自定义对话框模板(尽管 findtext() api api do do)。

但是,您的情况还有另一个解决方法...

tfinddialog.onshow 事件中,使用 findwindowex() 在对话框中手动查找编辑字段的 hwnd ,然后使用shell的 iautocomplete 接口启用该 hwnd 上的下拉列表。您可以编写一个实现 noreferrer“> ienumstring 接口提供您要出现在该下拉列表中的条目(例如,通过包装 tstringlist 您存储条目)。

有关更多详细信息,请参见MSDN文档:

使用自动完成

如何启用自动完整的自动完整

href 请参阅:

此答案对于Delphi?

此答案 to

此答案tstringsadapter?

I currently use a standard FindDialog in my Delphi application.

How can I change the text box to a combo box?

You can't, at least not with TFindDialog, as it does not allow the use of a custom dialog template (the underlying FindText() API does, though).

However, there is another workaround for your situation...

In the TFindDialog.OnShow event, use FindWindowEx() to manually find the HWND of the Edit field in the dialog, and then use the Shell's IAutoComplete interface to enable a drop-down list on that HWND. You can write a class that implements the IEnumString interface to provide the entries that you want to appear in that drop-down list (for instance, by wrapping a TStringList that you store your entries in).

See MSDN documentation for more details:

Using Autocomplete

How to Enable Autocomplete Manually

Also see:

This answer to Google like edit/combo control for Delphi?

This answer to Auto append/complete from text file to an edit box delphi

This answer to How to use IAutoComplete together with TStringsAdapter?

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