Re: Panel & keyboard focus by Mikhail
Mikhail
Tue Nov 30 05:31:51 CST 2004
Thank you. It works!
I just wonder why Panel control can't receive keyboard input.
--
With best regards,
Mikhail
"Bruce Wood" <brucewood@canada.com> wrote in message
news:a6abb9ad.0411291456.3b0e1eb5@posting.google.com...
> Is it possible to think about this problem from another angle? Could
> you have the control itself handle the keyboard event when it has
> focus, or would that end up bastardizing the purpose of the control?
>
> In other words, could you change your own controls to know "A DEL
> keypress means that I should delete myself from my enclosing panel
> when I am on the panel that allows deletions"? Rather than having the
> panel know to delete the control, have the control know to delete
> itself when it is in that panel and it receives a DEL keypress?
>
> Of course, this may not be reasonable if the controls are generic use
> and this is simply a special situation that you don't want to code
> into the controls. Just an idea.
>
> "Mikhail Fedosov" <mike@nomail.ru> wrote in message
> news:<eeWiv6h1EHA.208@TK2MSFTNGP12.phx.gbl>...
>> I have a panel and some of my controls on it (each control is derived
>> from
>> Control, not from UserControl). I need to delete the selected control by
>> pressing the Del key. How it can be done? Panel does not process any
>> keyboard events. Also I don't want to delete any controls when focus is
>> on
>> the other controls of the form.
>>
>> So the scenario is something like this:
>> 1. User clicks on some of my controls (panel receives focus)
>> 2. User press Del key (control removes from panel)
>> 3. User press Tab key (the focus is received by another control of the
>> form,
>> but not a control of the panel)
>> 4. User press Del key (nothing happens)
>>
>> So the main question is how can I monitor focus state of the panel and
>> process the keygboard input?
>>
>> Thank you very much.