I have VST with MultiSelect option enabled. How can I retrieve the list of selected nodes in VirtualStringTree when the selection changes via keyboard events?
I tried using the below code in the OnFocusChanged event
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;
This works fine if I use the mouse and shift key, however, if I use the keyboard, i.e select node, then press shift and then down arrow to select multiple nodes, the selection returns the full list - 1.
This seems like a bug? Any ideas on how to get the full selection when using the keyboard?