I'm not having much luck registering for user interaction with my UltraWinTree. There seems to be very few events I can register for.
What I want is to know when the user clicks a parent node so that I can go through all the children and select them as well.
My nodes do not have the NodeStyle property set to CheckBox, because for whatever reason, I cannot do this AND have the ViewStyle set to FreeForm (which, why is that?). And, to answer your question, I have the ViewStyle set to FreeForm so I can implement a ColumnSet with various data types.
Here's what I have:
- Parent 0: Column 0 = bool, Column 1 = string
- Child 0: Column 0 = bool, Column 1 = string, Column 2 = int, Column 3 = string
- Child 1: Column 0 = bool, Column 1 = string, Column 2 = int, Column 3 = string
- Child n: Column 0 = bool, Column 1 = string, Column 2 = int, Column 3 = string
When Parent 0 is clicked, I want to go through Child 0 through n and select them as well. But, I have no knowledge of when Parent 0 is clicked.
Any suggestions?
Hi,
Do you only want to do this when the use clicks on a node? Or any time the node is activated? Nodes can also be activated via the keyboard.
If you only care about clicking, then you will need to use the MouseDown or MouseUp events and get the node that was clicked with the GetNodeFromPoint method.
If you want to track any time the active node changes, use the AfterActivate event.
If you are using selection, then another event you might consider is the AfterSelect event.
Thanks for getting back with me!
The GetNodeFromPoint method worked great! I registered for the MouseClick event at the Tree level, and then used
UltraTreeNode node = tree.GetNodeFromPoint(e.X, e.Y)
which returned the node that was clicked on. Thanks!
Just for kicks, I was also able to register for the "CellValueChanged" event to tell me when a node of type bool changed. Both options work.
Thanks again!