If I select a node in code, all nodes are deselected (FSelectedNodes.Clear;) before the node will be selected. How can I select a node without deselecting the currently selected nodes?
For a quick solution I patched the unit FMX.TMSCustomTreeView:
procedure TTMSFMXCustomTreeView.SelectVirtualNode(ANode: TTMSFMXTreeViewVirtualNode);
var
en: Boolean;
begin
// nol- FSelectedNodes.Clear;
if Assigned(ANode) then
begin
en := IsVirtualNodeSelectable(ANode);
if en then
begin
FSelectedNodes.Add(ANode);
FFocusedNode := ANode;
end;
end;
Repaint;
end;
I'm not sure exactly what you want to achieve. You either want to select a single node, or multiple nodes. If you want to select one node, you just give an array of one item in the SelectNodes call. If you want to select another node, you need to include the original node. There is no alternative for this.
I want to add a node to the currently selected nodes list.
If I use your suggestion to use TMSFMXTreeView1.SelectNodes(Array), how can I access the Array of the currently selected nodes? Then I could TMSFMXTreeView1.SelectNodes(CurrentSelectedNodesArray + NodeToSelect)