I need to be able to determine if a node was activated as a result of a user click(as opposed to a programatic activation or other automatic behavior).
I have looked at the Click event of the UltraTree, but this seems to be triggered after the AfterActivate(and AfterSelect) events. So setting a flag in the click event and then inspecting it in the AfterActivate event can't work.
You could use the MouseDown event, which also has the benefit of giving you the client coordinates of the point at which the user clicked. This can be passed to the UltraTree.GetNodeFromPoint method to hit test for a node.
Srry, you did mention that originally, I didn't read closely enough. The following code same demonstrates how to work around that:
private bool nodeSelected = false;
private void ultraTree1_AfterSelect(object sender, SelectEventArgs e){ this.nodeSelected = true;}
private void ultraTree1_KeyUp(object sender, KeyEventArgs e){ this.nodeSelected = false;}
private void ultraTree1_MouseDown(object sender, MouseEventArgs e){ UltraTree tree = sender as UltraTree; tree.BeginInvoke( new MethodInvoker(this.OnMouseDownAsync) ); }
private void OnMouseDownAsync(){ if ( this.nodeSelected ) { this.nodeSelected = false; this.OnMouseSelect(); }}
private void OnMouseSelect(){}
[EDIT]
peljam said:while those events are taking place