Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: preventing controls from handling key events

26 views
Skip to first unread message

Sergey Bogdanov

unread,
Jan 19, 2005, 1:46:16 AM1/19/05
to
You can suppress alphanumeric key by using KeyDown handler together with
KeyPress handler but this method doesn't work for Up/Down keys in the
multiline textbox. To avoid this problem use OpenNETCF IMessageFilter to
handle WM_KEYDOWN for your control. Here's how to accomplish it:

http://www.sergeybogdanov.com/Samples/TextBoxKeyDownFilter.zip

The same technique can be used to ComboBox control.

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com

Michal Rizek wrote:
> Hallo,
> i would like to prevent TextBox and ComboBox from handling some keyevents. I
> have installed SP3. For example TextBox should not handle Keys.Up/Down,
> ComboBox should not handle alphabetic keys ans so on... (i would like make
> own handlers in derived controls).
> I tryed to register KeyDown handler witch sets KeyEventArgs.Handled to true,
> override OnKeyDown,Up,Press without calling base.OnKey... but without any
> success. Is there any way to do so?

Michal Rizek

unread,
Jan 19, 2005, 4:21:01 AM1/19/05
to
Thank you Sergey, IMessageFilter is what i was looking for.

Miron Ophir

unread,
Jan 30, 2005, 11:26:49 AM1/30/05
to
How do you get the control to get the events in the first place?
Under smartphone, they are not getting to the control?

Miron

"Michal Rizek" <Micha...@discussions.microsoft.com> wrote in message
news:44C77A6C-7FC3-4FEC...@microsoft.com...

0 new messages