A
Andrew Lighten
Hi;
I've built the guts of an explorer style application in C#. It has a
tree view on the left showing a series of nodes that are relevant to my
user, and as they click on each one, the right-hand side of my window
shows the particular panel that's relevant to the selected node.
I have one minor frustration, however. What I'd like to do is focus on
the first control within the newly chosen panel. I know which control
this is, and I can transfer focus to it by Select()'ing it, but once the
tree control has finished its AfterSelect() event it steals focus back
again.
I've got a dual monitor setup and I can step through my tree control's
AfterSelect() event handler. My new panel is selected, completely drawn
by calling Update(), the first control on the panel is selected and
focused on and the tree loses focus. Finally, when I step off the end of
AfterSelect(), focus magically snaps back to the tree.
I'd really like focus to stay on my newly selected panel rather than the
tree.
(1) Am I fighting a pointless battle here? Should focus stay with the tree?
(2) If it's not extremely rude to move focus to the new panel and leave
it there, how do I do it?
Thanks,
Andrew.
I've built the guts of an explorer style application in C#. It has a
tree view on the left showing a series of nodes that are relevant to my
user, and as they click on each one, the right-hand side of my window
shows the particular panel that's relevant to the selected node.
I have one minor frustration, however. What I'd like to do is focus on
the first control within the newly chosen panel. I know which control
this is, and I can transfer focus to it by Select()'ing it, but once the
tree control has finished its AfterSelect() event it steals focus back
again.
I've got a dual monitor setup and I can step through my tree control's
AfterSelect() event handler. My new panel is selected, completely drawn
by calling Update(), the first control on the panel is selected and
focused on and the tree loses focus. Finally, when I step off the end of
AfterSelect(), focus magically snaps back to the tree.
I'd really like focus to stay on my newly selected panel rather than the
tree.
(1) Am I fighting a pointless battle here? Should focus stay with the tree?
(2) If it's not extremely rude to move focus to the new panel and leave
it there, how do I do it?
Thanks,
Andrew.