PC Review


Reply
Thread Tools Rate Thread

Capture all Key Press events

 
 
Chris Auld
Guest
Posts: n/a
 
      6th Nov 2003
Does anyone know of an elegant approach to capture all keypress events
on a form no matter what control is active?
Basically I have a PPC with hardware key pad and I always want the
KeyPress to affect a certain control.

Cheers
Chris
 
Reply With Quote
 
 
 
 
PeterB
Guest
Posts: n/a
 
      6th Nov 2003
There is no "event passing" as there is in Delphi (correct me if I am
wrong), where an event would be passed from an active control to the
underlying form (or other parent container) if the control didn't have that
specific event. As far as I know, you need to add the event to all focusable
controls if you want to make sure it fires no matter what control is
focused.

Another problem with the current version of compact framework is that many
controls don't even support key press events (such as the combobox), which
has caused a lot of trouble for developers who are using managed code and
not as familiar with low level hooking etc. Luckily, Service Pack 2 for the
compact framework will add key press support to most controls.

Hope that answers your question.

/ Peter



"Chris Auld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Does anyone know of an elegant approach to capture all keypress events
> on a form no matter what control is active?
> Basically I have a PPC with hardware key pad and I always want the
> KeyPress to affect a certain control.
>
> Cheers
> Chris



 
Reply With Quote
 
Maloney
Guest
Posts: n/a
 
      6th Nov 2003
Use RegisterHotKey to get when the hardware buttons are pressed. Take a
look at
http://www.opennetcf.org/Forums/topi...chTerms=hotkey

"Chris Auld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Does anyone know of an elegant approach to capture all keypress events
> on a form no matter what control is active?
> Basically I have a PPC with hardware key pad and I always want the
> KeyPress to affect a certain control.
>
> Cheers
> Chris



 
Reply With Quote
 
Ginny Caughey [MVP]
Guest
Posts: n/a
 
      6th Nov 2003
Chris,

Take a look at the MessageWindow class. You can use it to catch Windows
messages and then dispatch the ones you're interested in to your form.
Whether this solution is elegant or not I'll leave for you to decide. ;-)
Here's a link to the QuickStart tutorial that describes it:
http://samples.gotdotnet.com/quickst...agewindow.aspx
--
Ginny Caughey
..Net Compact Framework MVP

"Chris Auld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Does anyone know of an elegant approach to capture all keypress events
> on a form no matter what control is active?
> Basically I have a PPC with hardware key pad and I always want the
> KeyPress to affect a certain control.
>
> Cheers
> Chris



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to capture the event that someone press a 'del' key when highlight a row in a datagrid? ywchan Microsoft C# .NET 1 16th Jul 2005 07:04 AM
Capture Key Press Bob Achgill Microsoft VB .NET 7 11th May 2004 08:44 PM
Capture Action Button Press David Hanson Microsoft Dot NET Compact Framework 2 31st Oct 2003 10:30 PM
capture press power off from device Alf Microsoft Dot NET Compact Framework 1 17th Oct 2003 11:04 PM
Capture Function Key press event MS Newsgroups Microsoft VB .NET 5 2nd Sep 2003 11:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:53 PM.