Virtual-TreeView icon indicating copy to clipboard operation
Virtual-TreeView copied to clipboard

Always select next node upon deletion of the selected node

Open joachimmarder opened this issue 6 years ago • 7 comments

Could it make sense to always select the next node, if the currently selected one is getting deleted?

If this behavior is too different compared to the current one, we could add a tree option like toSelectNextNodeOnRemval

joachimmarder avatar Dec 12 '18 16:12 joachimmarder

a tree option is better, somethimes a don't need see more selected nodes. and the selection should stay on same node level.

landrix avatar Dec 13 '18 08:12 landrix

a tree option+

supasoft avatar Apr 02 '19 14:04 supasoft

I like the idea of built-in logic but unfortunately VTV is a tree and there are plenty of cases that not exist in list controls:

  • deleting last node (select previous sibling? select previous visible regardless of its level?)
  • deleting single node on a level (select next visible regardless of its level? Select next node of the same level? Select parent node?)
  • what if a node that is to be selected must not receive focus by app's requirements?

I'm afraid simple cases will be used quite rarely. But - if there will be an option for this, it could help in simple cases.

Fr0sT-Brutal avatar Jul 16 '19 14:07 Fr0sT-Brutal

there are plenty of cases that not exist in list controls

I don't see a problem here. The Windows TreeView common control as used in Windows Explorer gives a good blueprint for the behavior, and users are somewhat used to it.

deleting last node

I would select the previous sibling.

deleting single node on a level

Select parent. This is already implemented in UpdateNextNodeToSelect().

what if a node that is to be selected must not receive focus by app's requirements?

I don't see a significant difference to e.g. when user navigates the tree using the cursor keys. There are events that allow to prevent the selection of focusing of a node.

joachimmarder avatar Jul 16 '19 15:07 joachimmarder

OK then, the feature could be done easily :)

Fr0sT-Brutal avatar Jul 17 '19 07:07 Fr0sT-Brutal

Yes, the remaining question was, if this should be an optional behavior.

joachimmarder avatar Jul 17 '19 20:07 joachimmarder

Make it optional please, so we're flexible.

MHumm avatar Apr 27 '21 12:04 MHumm