473,405 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Cannot reliably trap certain keys on the 10-key pad???

OC
Because of the requirements on a high-speed data entry form, I need to
reliably trap certain keys (specifically the "/", "*", "-", and "+") keys on
the 10-key pad and treat them as "Function keys". This MOSTLY works, however
I am finding that not with all workstations. Does anyone know what kind of
nuance might be involved here and how to avoid it? (I know it can be done
because the CICS emulators on these same workstations are able to remap
these keys via software.)

I am using the following in a base child form:

public bool PreFilterMessage(ref Message m)
{
const int WM_KEYDOWN = 0x100;
if (m.Msg == WM_KEYDOWN)
return HandleKeys((Keys)(int)m.WParam & Keys.KeyCode);
else
return false;
}

public BaseChildView()
{
InitializeComponent();
Application.AddMessageFilter(this);
mainMenu = new MainMenu();
}

private bool HandleKeys(Keys keyCode)
{
bool ret = false;
switch (keyCode)
{
case Keys.Enter: ret = EnterKeyPressed(); break;
case Keys.Add: ret = AddKeyPressed(); break;
case Keys.F1: ret = F1KeyPressed(); break;
case Keys.F2: ret = F2KeyPressed(); break;
case Keys.Divide: // used by ten-key data entry
case Keys.F3: ret = F3KeyPressed(); break;
case Keys.F4: ret = F4KeyPressed(); break;
case Keys.F5: ret = F5KeyPressed(); break;
case Keys.Multiply: // used by ten-key data entry
case Keys.F6: ret = F6KeyPressed(); break;
case Keys.F7: ret = F7KeyPressed(); break;
case Keys.F8: ret = F8KeyPressed(); break;
case Keys.Subtract: // used by ten-key data entry
case Keys.F9: ret = F9KeyPressed(); break;
case Keys.F10: ret = F10KeyPressed(); break;
case Keys.F11: ret = F11KeyPressed(); break;
case Keys.F12: ret = F12KeyPressed(); break;
default: ret = false; break;
}
return ret;
}

protected virtual bool EnterKeyPressed() {return false;}
protected virtual bool AddKeyPressed() {return false;}
protected virtual bool F1KeyPressed() {return false;}
protected virtual bool F2KeyPressed() {return false;}
protected virtual bool F3KeyPressed() {return false;}
protected virtual bool F4KeyPressed() {return false;}
protected virtual bool F5KeyPressed() {return false;}
protected virtual bool F6KeyPressed() {return false;}
protected virtual bool F7KeyPressed() {return false;}
protected virtual bool F8KeyPressed() {return false;}
protected virtual bool F9KeyPressed() {return false;}
protected virtual bool F10KeyPressed() {return false;}
protected virtual bool F11KeyPressed() {return false;}
protected virtual bool F12KeyPressed() {return false;}

private void BaseChildView_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
Application.RemoveMessageFilter(this);
}
Nov 15 '05 #1
0 1567

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

Similar topics

10
by: Jack | last post by:
Hi, I cannot get the date format correctly in dynamic sql statement, after trying various ways of handling it. I need some help with the date format in the following dynamic sql statement. Any...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
2
by: aj | last post by:
DB2 WSE LUW 8.1 Fixpak 5 Red Hat AS 2.1 Has anyone ever seen a db2diag.log indicate that a trap file was written, but it is *not* written? For the 3rd time in 18 months, I had a production...
18
by: Mantorok Redgormor | last post by:
What does a trap representation mean in the standard? And how can ~0 cause a trap representation? Could someone point out the relevant sections in the standard?
9
by: Woody Splawn | last post by:
On a winform, how do I trap for the user pressing Control Delete? I thought perhaps something like the following in the keydown event of the grid, but the code below does not work. If e.KeyCode...
2
by: Matthew | last post by:
When a user types Ctrl.+V in one form, I would like to trap the event and do something else. Is this possible? Matthew
8
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different...
4
by: EManning | last post by:
Using A2003. I've got an FE with a main form with a subform. The subform is a mixture of bound and unbound fields. The main form is unbound and all it has on it is a combobox to choose a...
0
by: Menlalen | last post by:
K E Y S , A L I C I A M P 3 D O W N L O A D *Fallin 2001* 'Keys, Alicia - Fallin' (http://tinyurl.com/4zg3sr) (3:30 4.82Mb 192kbps) 'Keys, Alicia - Fallin (ft BustaRhymes and Rampage)'...
13
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
This is a follow-up to my post "Silverlight video doesn't work when file is streamed from handler in ASP.net" at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.