I have a GUI where I have a tree view in the left pane and a gridview in the right pane. When I select a treenode, I change the gridvoew to match the tree node and this was working fine.
Now I am trying to add drag and drop support and find that I get the AfterSelect event before SelectionDragStart event and so deselect the old view, select a new view and now I can't drag to where I was hoping to drag to.
What I would like to do is if the user used the mouse to start dragging a tree node is to not have that node selected but just dragged.
Is this possible or normal?
Thanks, Dave
You should probably take a look at the UltraTree.Override.SelectionType property; I think in your case you want to set it to Extended/Single, i.e., not the values with 'AutoDrag' in their name.
Thanks Brian but that does not work for me. I set that property to various settings, and in all cases, the events fire as: AfterActivate, AfterSelect on mouse down then SelectionDragStart when I nove the mouse while held down and so I have already changed views as a new node has been selected. WHat I want to happen is to get a DragStart when the mouse is down and moved and so I guess no activate or select until mouse up. Is this reasonable to want? How else would one start dragging a node without it being selected? Thanks, Dave
P.S. I implemented a ISelectionStrategyFilter based on SelectionStrategyExtendedAutoDrag but that does not seem to change anything. I did not add any custom code however and just return the base.OnMouseDown. I could find no doc on how/why to use that interface so don't know if it is even realted to my issue. I guess I was hoping the base class modified the behavior to what I was hoping for.
I think the crux of this is how to allow DragStart to occur on MouseDown and node selected on MouseUp if there was no drag. Most of the tree examples select the node on mouse down but the grid sample explorer does not select till mouse up though I have not figured out why/how yet. Please offer your suggestions. Thanks, Dave
Well the sample SamplesExplorer used the MSFT TreeView and not the UltrTree and that was the ONLY sample I could find where a node was not selected until mouse up so that was rather disappointing...let me know if there is a similar UltrTree means to not select a node till MouseUp.
Also, is the only difference between the active node and the selected node in regards to if multiple nodes are selected? In iow, if only one node can be selected, is it also always the active node? If not what else is the difference? Thanks.
Upon more experimentation, Extended/Single do exactly the opposite of what I want. It is impossible to start a drag by doing mouse down and moving on the node. You must first select the node and then try to drag it in a separate mouse click and it cannot be done in with a single operation. Still the autodrag is not what I want either. I want to start a drag without selecting or activating the node which I think means to somehow not allow the node to be selected or activated till mouse up. The problem with the node being selected before dragstart happens is that selecting the node changes my gridview and now I cannot drag the node into the view that was there since a new node being selected changes the grid view to that node rather than the one that was selected before trying to drag a different node.
Any suggestions? I'm sort of dead in the water till I figure out how to have select on mouse up not down?
Got it working pretty well. Would be nice if documentation actually had some decent text as to the purposes of the mehods rather than just echoing their name using some robo documenter.
OK I somewhat solved my problem by getting rid of the afterselect event and moving the logic to show a new node view on the click event. Now I need to figure out how to do the same with the keyboard as hitting the ENTER key does nothing.