C
Christian Stapfer
I have a usercontrol that contains another usercontrol,
which in turn contains a PictureBox control.
Under a certain condition, I need to set the input
focus on the outermost usercontrol. But once the PictureBox
control (the outermost usercontrol's grandchild) has got
the input focus, I cannot transfer the focus back to the
outermost usercontrol (at least not by simply invoking its
Focus() member function).
Why is this? What can I do to take away the keyboard input
focus from that grandchild, the PictureBox control, and
transfer it back to the outermost usercontrol? (I have tried
to find information about keyboard focus handling that seems
relevant to this question, but what I have found seems rather
far removed from what I need to understand here...)
Note: My application requires very little keyboard input:
mainly a few keyboard-accelerators, and the copy/paste/
cut/delete key. But the copy/paste/cut/delete key must
go to the right usercontrol, because copy/paste/cut/delete
must be handled differently, depending on which usercontrol
has the input focus (or, rather, should have it, from my
point of view). In essence, I am trying to base input
focus on the position of the mouse pointer: if that grandchild
PictureBox control does not have the mouse pointer within
its bounds, it should not receive keyboard input, i.e.
should not have input focus.
Regards and thanks in advance for any enlightenment on
this question,
Christian
which in turn contains a PictureBox control.
Under a certain condition, I need to set the input
focus on the outermost usercontrol. But once the PictureBox
control (the outermost usercontrol's grandchild) has got
the input focus, I cannot transfer the focus back to the
outermost usercontrol (at least not by simply invoking its
Focus() member function).
Why is this? What can I do to take away the keyboard input
focus from that grandchild, the PictureBox control, and
transfer it back to the outermost usercontrol? (I have tried
to find information about keyboard focus handling that seems
relevant to this question, but what I have found seems rather
far removed from what I need to understand here...)
Note: My application requires very little keyboard input:
mainly a few keyboard-accelerators, and the copy/paste/
cut/delete key. But the copy/paste/cut/delete key must
go to the right usercontrol, because copy/paste/cut/delete
must be handled differently, depending on which usercontrol
has the input focus (or, rather, should have it, from my
point of view). In essence, I am trying to base input
focus on the position of the mouse pointer: if that grandchild
PictureBox control does not have the mouse pointer within
its bounds, it should not receive keyboard input, i.e.
should not have input focus.
Regards and thanks in advance for any enlightenment on
this question,
Christian