0

I have hidden some VirtualTreeView items using VirtualTree.IsVisible[n] := false;.

In one function I iterate through all selected items using VirtualTree.GetNextSelected(n); method. But there is a problem - if I manually select a few items for example using CTRL-click or SHIFT, the items which get looped are the ones selected.

But if I press CTRL + A to select all then GetNextSelected gives me all nodes, including those which are hidden.

I did a workaround by checking if (VirtualTree.IsVisible[n]) ... to avoid looping through all items and fetch only visible ones, but this seems like a bug or maybe there is an option which controls how CTRL + A will behave - will it select only visible nodes or all of them?

So is this a bug or maybe I missed some selection option (I examined them all) or am I supposed to use some other method for looping only through visible nodes?

Coder12345
  • 3,431
  • 3
  • 33
  • 73
  • 2
    It's a design choice rather than a bug. You'll have to adapt to it. – David Heffernan Nov 22 '16 at 17:55
  • 1
    @DavidHeffernan Are you sure this is the case? Why then selecting using keyboard SHIFT+ARROW keys only selects visible nodes and not all the notes in-between the visible nodes which are hidden? It is kind of odd that CTRL+A would select hidden ones but SHIFT+Arrow would not? – Coder12345 Nov 22 '16 at 19:12
  • 2
    Regarding CTRL+A Virtual TreeView behaves like most other controls and Windows Explorer, a different behavior would be unexpected for the user and therefore a bad choice in my opinion. – Joachim Marder Nov 23 '16 at 13:20
  • OK lads, please copy paste this into an answer so I can approve it and move on. – Coder12345 Nov 23 '16 at 15:22

1 Answers1

1

As it appears by David Heffernan and Joachim Marder, it is a design choice and not a bug. For this reason, one needs to introduce a workaround when looping through items using GetNextSelected by checking if (VirtualTree.IsVisible[n]) ... to loop only through visible items.

Coder12345
  • 3,431
  • 3
  • 33
  • 73