473,507 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Usin ProcessCmdKey correctly

I have been overriding the ProcessCmdKey in my forms because I want to
handle some keystrokes that seem to disappear if I try to use the regular
key handling events. It seems to be working just fine, but there are some
things I don't understand, and I could use some advice.

1) The ProcessCmdKey takes a Windows message, and I feel like I should be
filtering for just one of the key messages (although to my surprise, I'm not
getting the behavior multiple times even though I don't filter on the
message.) So should I be checking the message? And if so, how do you do it
in C#? In C++, you seem to have enums over Windows Messages just available,
I supposed from some .h that is always included & I never think about, but I
don't know if they are available in C# or how to get them.

2) What is the affect of the return value? I have always been returning true
if I do something with a keystroke, but I don't know what that means?

3) I've been handling these things at the form level, but I really want them
to do stuff to a particular control (whether or not that control has focus.)
Is that really necessary, or could a control that doesn't have focus receive
message through its ProcessCmdKey? Something I read somewhere gave me the
idea that might be possible, but I'm having trouble understanding any of it.

Thanks,
Rachel.
Nov 16 '05 #1
0 1609

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
384
by: Susanne Christe | last post by:
Hi Folks, I'm trying to override protected ProcessCmdKey function in writing my a custom MyDataGrid. I get the Keys I want, but it takes no effect to MyDataGrid, if I try for example execute...
0
1541
by: stardv | last post by:
I am trying to override ProcessCmdKey to either bind the data on “Enter” key pressed or return the value of the current cell when enter is pressed on it, whatever would be easier. I have...
1
11656
by: Paul | last post by:
Hi, I am still confused the different between ProcessCmdKey and ProcessDialogKey. When to use it? I write a simple user control and these 2 override functions looks the same to me. ...
4
2531
by: jibran | last post by:
Hello. I have wrapped the DataGrid control with my own class (SmartDataGrid) adding some necessary functionality. My current webform has 2 SmartDataGrids. The first is populated by selected...
5
8595
by: Colin Graham | last post by:
I am using the following code on my form to capture whether the tab control has been pressed. Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData...
2
6065
by: Phil Galey | last post by:
I'm using the ProcessCmdKey event to capture various keys that are pressed. However, I'm having trouble capturing the combination of the CTRL key and, say, the DOWN key. If I just press the CTRL...
1
8267
by: John Richardson | last post by:
I'm trying to override the SHIFT-SPACE "negative feature" in the Winforms datagrid, to only be a space. The following link describes this:...
5
6125
by: Peted | last post by:
Hello, i am lookinf for the best way to trap any alphanumeric keypress in all multi key combminations and execute some code For example , i have a form visible using the form.showdialog...
2
6502
by: Trooper | last post by:
Hi! I need help with calling ProcessCmdKey. I'm little bit confused how to use this method from my app. How to call it, from where? Can somebody explain to me? Thnx. This is the source:
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.