我启用了 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;
如果我使用鼠标和 shift 键,这很好用,但是,如果我使用键盘,即选择节点,然后按 shift,然后按向下箭头选择多个节点,则选择返回完整列表 - 1。
这似乎是一个错误?关于如何在使用键盘时获得完整选择的任何想法?