Hi,
I have a WinTree that is populated at runtime based on the users selection. Once populated the user of course selects a node, and then the program continues from there.
However, the issue I have is that I have used the example code from the Infragistics Help file to determine which node was selected and the event fires even when the user simply clicks on the Plus (+) to expand a node.
private void ultraTree1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){UltraTree tree;tree = sender as UltraTree;UltraTreeNode aNode;aNode = tree.GetNodeFromPoint(e.X, e.Y);if (aNode != null)this.ultraTextEditor1.Text = aNode.Text; }
object
as
if
null
this
How can I determine the selected node with the event only firing when the user clicks on the node itself instead of on the expand/collapse node symbol.
Cheers
Jason
Jason,
You could add a filter to your code based on what UIElement recieved the mouse event.
private void ultraTree1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){UltraTree tree;tree = sender as UltraTree; Infragistics.Win.UIElement ui = tree.UIElement.ElementFromPoint( new System.Drawing.Point(e.X, e.Y)); if (ui is Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement || null != ui.GetAncestor(typeof(Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement))) { UltraTreeNode aNode; aNode = tree.GetNodeFromPoint(e.X, e.Y); if (aNode != null) this.ultraTextEditor1.Text = aNode.Text; }}
private void ultraTree1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e){UltraTree tree;tree = sender as UltraTree;
Infragistics.Win.UIElement ui = tree.UIElement.ElementFromPoint( new System.Drawing.Point(e.X, e.Y)); if (ui is Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement || null != ui.GetAncestor(typeof(Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement))) {
UltraTreeNode aNode; aNode = tree.GetNodeFromPoint(e.X, e.Y); if (aNode != null) this.ultraTextEditor1.Text = aNode.Text;
}}
That should allow you to concentrate on the text area of the node rather than the expansion indicator.
Would someone please convert the filter part of the code to VB 2005. I have been trying for some time to apply this code into my VB project but have been having troubles.
I am trying to accomplish the same things as the orginal post author.
Infragistics.Win.UIElement ui = tree.UIElement.ElementFromPoint( new System.Drawing.Point(e.X, e.Y)); if (ui is Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement || null != ui.GetAncestor(typeof(Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement)))
Thank you so much for your assistance. The code you provided worked exactly the way I needed it to.
Have a great day.