hobbesk_ati
asked on
Lost Focus of control
Hello evryone,
I have a windows form on which i have 2 treeview controls and a Tab Control (with picture boxes in each tab pages)
It looks like this:
TreeView 1| Treeview 2| tab control(Picture Box on each tab page)
One selecting every node in any tree it shows one or multiple pictures related to the item selected in the tree in the tab control.
The problem is On every select of tree node, i am creating the tab pages dynamically and loading pictures on them.
On this My foucs is lost to the tab control and picture box control.
How can i retain my focus in this case?
Thanks very much for all your help.
I have a windows form on which i have 2 treeview controls and a Tab Control (with picture boxes in each tab pages)
It looks like this:
TreeView 1| Treeview 2| tab control(Picture Box on each tab page)
One selecting every node in any tree it shows one or multiple pictures related to the item selected in the tree in the tab control.
The problem is On every select of tree node, i am creating the tab pages dynamically and loading pictures on them.
On this My foucs is lost to the tab control and picture box control.
How can i retain my focus in this case?
Thanks very much for all your help.
use the Focus() method of the tab control.
ASKER
I think i did not explain my problem property.
On Slecting Node:
I created tab pages dynamically and load picture box control it.
When doing so the control moves to Selected Tab Page.
But i want the TreeView to have focus on which the user clicked.
Is there anyway I can make sure that the tab page does not get focus itself in this case.
I can do TreeView.Focus() to set back the focus on the treeview after the loading tab page is done.
But i want to avoid this as in this case, I can have many treeviews and I would not know which TreeView i should use Focus() on.
Thanks again
On Slecting Node:
I created tab pages dynamically and load picture box control it.
When doing so the control moves to Selected Tab Page.
But i want the TreeView to have focus on which the user clicked.
Is there anyway I can make sure that the tab page does not get focus itself in this case.
I can do TreeView.Focus() to set back the focus on the treeview after the loading tab page is done.
But i want to avoid this as in this case, I can have many treeviews and I would not know which TreeView i should use Focus() on.
Thanks again
It is hard to tell how it's better to do that without seeng the code. However as I guess you call some "create tab page method" fro the node_click event of the tree. After calling the method you may call something like "this_tree.Focus(). And same for all others trees.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your suggestions.