Select treenode automatically
-
-
My form has two tree views. If select treenode from first tree with UpArrow or DownArrow button from keyboard, i want the treenode from the second treeview to be selected automatically. These treeviews have the same treenode. Thanks axiom.kid :confused:
Is there not a selection changed event on the tree control ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Is there not a selection changed event on the tree control ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
You are right. There are two. BeforeSelect, and AfterSelect. So, use whichever one you prefer, and as the selection changes, select the right node in the other control.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
You are right. There are two. BeforeSelect, and AfterSelect. So, use whichever one you prefer, and as the selection changes, select the right node in the other control.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, if the control is broken, if the events that should fire, do not, then your only other option as far as I can see, is to use a timer to check when one is changed, and then change the other, or use the keyboard events to detect when a keypress occurs on the control, and then from there, check if the selection has changed.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Your code sucks. I just wrote a sample project and it works just fine. Press a key to change selection and the beforeselect and afterselect events fire, with a keyup event in the middle. If you want help here, it helps to post your code, so we can tell you where it is broken, although in this case, it's very simple. Hook up the event, and it will fire.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Your code sucks. I just wrote a sample project and it works just fine. Press a key to change selection and the beforeselect and afterselect events fire, with a keyup event in the middle. If you want help here, it helps to post your code, so we can tell you where it is broken, although in this case, it's very simple. Hook up the event, and it will fire.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Thanks a lot for replying me. My two trees worked with the following code. private void sourcetree_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { if(destinationtree.SelectedNode.PrevVisibleNode != null) destinationtree.SelectedNode = destinationtree.SelectedNode.PrevVisibleNode; } else { if(destinationtree.SelectedNode.NextVisibleNode != null) destinationtree.SelectedNode = destinationtree.SelectedNode.NextVisibleNode; } }
-
Your code sucks. I just wrote a sample project and it works just fine. Press a key to change selection and the beforeselect and afterselect events fire, with a keyup event in the middle. If you want help here, it helps to post your code, so we can tell you where it is broken, although in this case, it's very simple. Hook up the event, and it will fire.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
Your code sucks
I've not been around for about 8 months - first post I read shows not much as changed around here!! Superb. :)
Knowledge is hereditary, it will find its way up or down. Luc Pattyn
and since what every time when i want to add button to this control one add two times posted in C# forum -
Your code sucks. I just wrote a sample project and it works just fine. Press a key to change selection and the beforeselect and afterselect events fire, with a keyup event in the middle. If you want help here, it helps to post your code, so we can tell you where it is broken, although in this case, it's very simple. Hook up the event, and it will fire.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
Your code sucks.
Hey, you're back. :-D