Hi,
I'd like right clicks to work exactly the same as left clicks. Is there an easy way to do this. Just setting the Selected and ActiveNode properties is not sufficient. I'd like to be able to handle multi selects as well depending on the state of the shift and control keys.
Thanks,
Bill
No, the intrinsic selection support for the control works off the left button and not the right. There are methods exposed by the ISelectionManager interface (which UltraTree implements) that provide a way for you to simulate user selection so you could probably code this, but there is no "easy way" to do it.
Hi Brian,
Thanks for the help. This code seems to work(basically turn a right click into a left click):
private void UltraTreeMouseDown(Object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right ) { UltraTree treeControl = (UltraTree)sender; UltraTreeNode nodeAtPoint = treeControl.GetNodeFromPoint(e.Location); if (nodeAtPoint != null) { ISelectionManager selectionManager = treeControl; ISelectionStrategy strategy = selectionManager.GetSelectionStrategy(nodeAtPoint);
if (strategy!=null) { MouseMessageInfo info = new MouseMessageInfo(MouseButtons.Left, MouseMessageType.Down, e.X, e.Y); strategy.OnMouseMessage(nodeAtPoint, ref info); } } } }
Do you see any side effects to this approach?
Not off the top of my head, but you would probably want to do some testing just the same to make sure you get the behavior you want.