There is a Tree View, MultiSelect:=true
.
If to select all items then it is impossible to unselect or to select again but others. I think I need to do TreeView1.Selected.Selected:=false;
on TForm1.TreeView1Click
. But how to know if a click was not on controls: items, buttons?
A video: http://liga-installer.realservers.info/select.mp4
Is a code below normal?
procedure TForm1.TreeView1Click(Sender: TObject);
var
Item: TTreeNode;
begin
Item :=TTreeView(Sender).GetNodeAt(TTreeView(Sender).ScreenToClient(Mouse.CursorPos).X,
TTreeView(Sender).ScreenToClient(Mouse.CursorPos).y);
if (not Assigned(Item)) and (TTreeView(Sender).SelectionCount>0) then TTreeView(Sender).Select(nil, []);
end;
Thanks!
You are supposed to hold down the Shift key while clicking the first selected item. You can also deselect one item at a time by Ctrl-clicking it.
But I agree it is counter-intuitive. I'd do