Delphi XE 中有带标题的虚拟列表框吗?

发布于 2024-11-19 18:26:17 字数 521 浏览 2 评论 0原文

抱歉,这个背景有点复杂...我正在将 D5 项目转换为 DXE...它有一个包含数千项的列表框。在搜索框中每次击键都会对这些项目进行完整的渐进式文本搜索。在 D5(虚拟列表之前)中,我必须使用 LMD 列表框(因为列表框中有几列带有标题)、一个单独的滚动条和一个记录数组来创建自己的虚拟列表框。当用户浏览搜索结果或修改搜索时,列表框将被填充。这表现得很好,但由于现在虚拟列表框是 Delphi 原生的,我打算将自定义列表框转换为原生列表框,但我找不到具有虚拟功能的标题的列表框组件。帮助?

是否有可用的组件具有虚拟列表和标题/列?

我忘了提及:我知道 Soft Gems VirtualTreeView 组件 - 这些非常好,可能是我将要使用的,但是... DXE 中有没有一种方法可以在没有第 3 方实用程序的情况下完成此任务?我担心我在 DXE 中遗漏了一些明显的东西,因为我只使用它大约一个月。

Sorry, background's a little convoluted on this one... I am in the process of converting a D5 project to DXE... It has a listbox with several thousand items. A full progressive text search is done on these items with each keystroke in the searchbox. In D5 (pre-virtual lists), I had to make my own virtual listbox using the LMD listbox (as there were several columns with headers in the listbox), a separate scrollbar and an Array of records. The Listbox would then be populated as the user navigated through the search results or by modifying the search. This performed very well but since now virtual listboxes are native to Delphi I was going to convert my custom listbox to the native one but I cannot find a listbox component with headers that is virtual-capable. Help?

Is there a component available that has virtual lists and headers/columns?

I forgot to mention: I am aware of Soft Gems VirtualTreeView components - these are excellent and is probably what I'll be using but... Is there a way in DXE to accomplish this without 3rd party utilities? I'm concerned that I'm missing something obvious in DXE as I've only been using it for about a month.

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

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

发布评论

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

评论(2

寄居人 2024-11-26 18:26:17

TListView 是 Windows 列表视图公共控件的薄包装。在虚拟模式下使用报告视图样式运行它,以实现我相信您所要求的目标。


为了设置虚拟列表视图,您需要将 OwnerData 设置为 True 并提供 OnData 事件处理程序。

procedure TVirtualListViewForm.FormCreate(Sender: TObject);
begin
  ListView1.ViewStyle := vsReport;
  ListView1.Columns.Add.Caption := 'Column1';
  ListView1.Columns.Add.Caption := 'Column2';
  ListView1.OwnerData := True;
  ListView1.OnData := ListViewData;
  ListView1.Items.Count := 42;
end;

procedure TVirtualListViewForm.ListViewData(Sender: TObject; Item: TListItem);
begin
  Item.Caption := Format('Column 0, index %d', [Item.Index]);
  Item.SubItems.Add(Format('Column 1, index %d', [Item.Index]));
end;

根据您的需要,可能需要 OnDataFind 来实现渐进式文本搜索。

TListView is a thin wrapper around the Windows list view common control. Run it in virtual mode with report view style to achieve what I believe you are asking for.


In order to set up a virtual list view you need to set OwnerData to True and supply an OnData event handler.

procedure TVirtualListViewForm.FormCreate(Sender: TObject);
begin
  ListView1.ViewStyle := vsReport;
  ListView1.Columns.Add.Caption := 'Column1';
  ListView1.Columns.Add.Caption := 'Column2';
  ListView1.OwnerData := True;
  ListView1.OnData := ListViewData;
  ListView1.Items.Count := 42;
end;

procedure TVirtualListViewForm.ListViewData(Sender: TObject; Item: TListItem);
begin
  Item.Caption := Format('Column 0, index %d', [Item.Index]);
  Item.SubItems.Add(Format('Column 1, index %d', [Item.Index]));
end;

For your needs an OnDataFind may be needed to implement the progressive text search.

唔猫 2024-11-26 18:26:17

您可以使用我的组件 TDzListHeader,可在 GitHub 上找到: https://github.com/digao-dalpiaz/DzListHeader

该组件允许您在 TCollection 中创建列,您应该将 TListBox 放入 TListHeader 中,然后链接它们。

DzListHeader 示例

所有用法和详细文档都可以在 github 项目中找到。

You can use my component TDzListHeader, available at GitHub: https://github.com/digao-dalpiaz/DzListHeader

This component allows you to create columns in a TCollection and you should drop a TListBox inside the TListHeader, and link them.

DzListHeader example

All usage and detailed documentation are available at github project.

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