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
The afterActivate event doesn't work with the OutlookExpress Style as desired. The event will be fired when the expansion indicator is clicked too. Is there another way to this?
In VB, the code would look something like this:
Private Sub UltraTree1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles UltraTree1.MouseUp Dim tree As UltraTree tree = CType(sender, UltraTree) Dim ui As Infragistics.Win.UIElement = tree.UIElement.ElementFromPoint(New System.Drawing.Point(e.X, e.Y)) If Not TypeOf ui Is Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement Then ui = ui.GetAncestor(GetType(Infragistics.Win.UltraWinTree.NodeSelectableAreaUIElement)) End If If (Not ui Is Nothing) Then Dim aNode As UltraTreeNode aNode = tree.GetNodeFromPoint(e.X, e.Y) If (Not aNode Is Nothing) Then Me.ultraTextEditor1.Text = aNode.Text End If End If End Sub
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.
Or you could just use the AfterActivate event to trap when the active node changes. This is better, because it will also respond when the selected node changed via the keyboard.