I have a tree on the left side. Selecting node displays the relevant information in the form on the right.
Can I save the tree and any control (text box, combo box, check box) on the right in focus at the same time? This will allow the user to select a field, make changes, select another node, and without having to go back and select the same field again, just enter and change the value of the same field.
Thanx.
EDIT
I assume that you can perform this behavior manually:
private Control __cFocus; private void {anyControl}_Focus(object sender, EventArgs e) { __cFocus = (Control)sender; } private void treeView1_AfterSelect(object sender, EventArgs e) { __cFocus.Focus(); }
I'm just wondering if there is an automatic / more elegant solution
EDIT 2
Good, so it seems to me that I will need to implement it manually. Then a manual implementation. However, another problem now arises; not sure if I should ask this as a separate question.
When you select node, the text field gets the focus as intended, but only when using the keyboard. This does not work when selecting a node with the mouse. At first I thought it might be a mouse event that is interfering, but step by step showed that the MouseUp
event fired first, and then an AfterSelect
event that sets focus, so I don't think it interferes. The textbox Enter
event also fires, but for some reason it loses focus again for the tree.
Thanx
source share