- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我启用了 MultiSelect 选项的 VST。 How can I retrieve the list of selected nodes in VirtualStringTree when the selection changes via keyboard events?
我尝试在 OnFocusChanged 事件中使用以下代码
procedure TForm1.UpdateSelection(VST: TVirtualStringTree);
Var
NodeArray: TNodeArray;
NodeData: PNodeData;
I: Integer;
begin
Memo1.Clear;
NodeArray := VST.GetSortedSelection(False);
For I := Low(NodeArray) to High(NodeArray) do
Begin
NodeData := VST.GetNodeData(NodeArray[I]);
Memo1.Lines.Add(NodeData.Caption);
End;
end;
procedure TForm1.VST1FocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex);
begin
UpdateSelection(VST1);
end;
最佳答案
我也可以重现这种行为(D5,VT 版本 4.5.5)。对我来说看起来像一个错误,我将解释原因:
似乎键盘事件调用 FocusChanged
但不改变内部FSelectedCount
此刻FocusChanged
事件被触发。如果您查看 GetSortedSelection
的代码,第一行是SetLength(Result, FSelectionCount);
如果你测试 VST1.SelectionCount
属性将其设置为实际选择计数 - 1(如您所描述),或者如果您按 SHIFT-END,则保留先前的值。
我从未在自己的应用程序中注意到这一点,因为我通过 PostMessage
使用了延迟操作在这个特定的事件中。当事件处理程序退出时,这会导致正确的内部结构。这可能是一种解决方案。
但是,我认为正确的解决方案是处理 OnChange
中的选择。事件处理程序 - 无论焦点节点更改如何,选择都可能更改。
关于delphi - 选择更改后如何检索 VirtualStringTree 中的选定节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40345918/
是的,我知道我发布了很多问题,但那是因为我要么需要保证我做对了,我做错了什么,要么我完全一无所知,并且在文档中找不到任何东西。无论如何, 我正在尝试检查重复的节点。这是我想要的方式: 循环遍历我的节点
我有一个带有 X header 和 x 根的 virtualstringtree(启用了网格线)。 我想将子项(至少 1 个)添加到只有 1 个文本位于中间并通过所有标题(独立)的根中。因此,无论我是
我在窗体上有一个virtualstringtree控件,该控件必须显示图像列表中某些节点的图标。这很好用,但是,对于某些节点,还必须显示与节点和正方形一样高的自定义绘制图标。 我正在使用OnBefor
我想在单元格文本已完全显示时显示提示。 所以,在表单的 OnCreate 上 procedure TForm1.FormCreate(Sender: TObject); begin Virtual
是否可以隐藏 VirtualStringTree 中的特定节点?我正在实现“过滤”功能(VST 充当包含列的列表),并且我希望避免每次更改过滤器时重新加载内容 - 相反,更快的方法是告诉 VST 不要
我想每个曾经使用过Delphi的VirtualStringTree的人都会同意它是一个很棒的控件。它是一个“虚拟”控件(您的数据必须保存在其他地方),所以我在想什么数据结构最适合这样的任务? IMO认
如果 VirtualStringTree 中的节点是多行的(与 Node.States 中的 Multiline 相比),那么如何使该节点中所有列(多行列除外)的文本垂直居中? 我尝试使用OnBefo
我正在尝试更改节点的索引,因为有些特定节点始终需要位于树的底部。我试图更改 Node.Index,但这并没有改变任何东西。所以我的问题是:如何更改 PVirtualNode 的索引? 谢谢! - 杰夫
VirtualStringTree的滚动条如何刷新如果每个节点高度都更改为不同的高度。因为,滚动仍然处于相同状态,导致滚动时无法查看其他节点。 toVariableNodeHeight选项不起作用?还
我有一个带有 X 个根和 X 个子节点的 VirtualStringTree。 每个根都有一个特殊的 NodeData 分配。 每个子节点都分配了另一个 NodeData。 我怎么知道 OnFreeN
我启用了 MultiSelect 选项的 VST。 How can I retrieve the list of selected nodes in VirtualStringTree when th
我正在寻找一个程序或某些东西,如果我右键单击一个节点(或通常在 VirtualStringTree 上),它就会被触发 我有以下场景: 我的 VST 接近 ListView 。 我只能用鼠标多选根节点
是否可以锁定VirtualStringTree中的第0列(带有节点名称)像在 Excel 中一样水平滚动吗? 最佳答案 如果我没记错的话,此功能是在版本 5 中引入的。要在其 Options 中设置列
我目前在树的 OnBeforeCellPaint 事件中使用此代码: if Node.Index mod 2 = 0 then begin TargetCanvas.Brush.Color :=
我使用 virtualstringtree 一段时间了。我将它用于两个不同的用途,首先是一个用于选择、显示数据的普通树,其次是作为一个网格来显示 SQL 语句的输出。 我加载到树中的所有数据都来自数据
我有一个包含 3 列的 VST,均匀地占用可用空间。 我已在 Header.Options 中设置了 hoAutoSpring,并且 所有列都设置了 Column[x].Option 和 coAuto
所以,我的最终目标是找到一种方法,通过客户端区域内的添加/删除按钮来列出项目(例如 vsReport 中的 TListView)。 例如: |----------------| |Old Item 1
我正在尝试将项目从 D6 移动到 D-XE3。使用 VirtualStringTree 5.10 版本在 OnSaveNode 和 OnLoadEvents 中保存和加载树数据时,我遇到了垃圾。我可能
当从控件拖动到 VirtualStringTree 时,如果该控件具有 TDragObject,则预计将其用作 OnDragDrop 和 OnDragOver 中的源,但它始终返回该组件。我相信这是一
我正在严格按照本教程来保存和加载我的 VirtualStringTree:http://wiki.freepascal.org/VirtualTreeview_Example_for_Lazarus我
我是一名优秀的程序员,十分优秀!