thank You for Your comments and observations.
Well, technically it is not a problem, but I am not sure, if the Tree View context menu would not be too "long" then. Probably I would let others decide that. As for drag and drop, the drag/drop functionality is already used for different purpose and there is no "neutral zone" between sibling tree view items. Thus when dropping, Your are always dropping an item on something, never "in-between", which would be crucial for reordering.adrianinsaval wrote: ↑Wed Mar 17, 2021 5:58 am Shouldn't these commands be added to the context menu? Otherwise I think many people will never know about it. Making it work through drag and drop would be ideal but keyboard shortcuts are a great improvement already.
The solution in pull request is very general, implemented on level of tree view items, disregarding any specific requirements. Probably we could add a possibility for classes derived from document object view provider to prevent "shuffling" their children. That would be quite easy.adrianinsaval wrote: ↑Wed Mar 17, 2021 5:58 am There are some issues though, this shouldn't allow reordering elements within a PartDesign container as the order of elements is relevant there, not sure if there are other workbenches were order in the tree is important. I'm also not sure if moving around the origin object inside a part container is a good idea but I guess that doesn't do any harm.
Yes, I can see that. The "problem" is in shortcut treatment. I will explain that for "Up" action, but "Down" behaves similarly. If the selected item is a first child, the "Move Up" menu item is disabled, to signal the user it is of no use anymore. This effectively removes the shortcut from the shortcut list and "Alt+Up" is sent directly to the tree view widget. Tree view ignores the "Alt" modifier and processes the key press as simple "Up" key. Basically, I can see two possible solutions right away:adrianinsaval wrote: ↑Wed Mar 17, 2021 5:58 am On a different and non critical note about UX, maybe when moving something within a container and reaching the limit the selection shouldn't continue to move past that while pressing alt+arrow. Consider the case were you want to move an item to the top of a container and you press alt+up-arrow many times, by accident you press the arrow key two times more than necessary, now the container has changed it's order and collapsed at the same time, this could be annoying.
1) A duplicate always present Alt+Up/Down shortcut, forwarding the key presses to (eventually disabled) menu functionality, which decides itself whether or not something is to be done.
or
2) Keep the menu commands always enabled, even if it does nothing, eventually displaying a modal dialog with some "You have reached end" information.
Again, I am not quite sure, what's the best, please let me know your opinions.
Kind regards,
Tomas