I'm programming for a CE device with reduced key board, no mouse, and no touch screen. As such, I have to tab from button to button to get the focus on the button i want. Then to invoke the button with focus i have to hit two keys on the key board to send a space in order to "click" the button. I want to just hit one key, the enter key, instead.
So, how do i trap the enter and turn it into a space?
I tried putting the following code in my form class, but it failed to compile saying "no sutable method found to override. Note I have "using System.Windows. Forms at the top and the object browser shows teh ProcessDialogKe ys is in there.
Any Ideas?
Here is the code that doesn't work:
protected override bool ProcessDialogKe y(Keys keyData)
{
switch (keyData)
{
case Keys.Enter:
case Keys.Space:
return base.ProcessDia logKey(Keys.Spa ce);
}
return base.ProcessDia logKey(keyData) ;
}
1 2011
Figured it out. Here's what i did:
added the handler:
this.btnExit.Ke yDown += new System.Windows. Forms.KeyEventH andler(btnExit_ KeyDown);
then added the function:
void btnExit_KeyDown (object sender, System.Windows. Forms.KeyEventA rgs e)
{
btnExit_Click(s ender, e);
}
Thus, doesn't matter what they press, the button gets invoked. And I can now identify the key pressed, so I can add logic to manage which keys will invoke and which will be ignored.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: lawrence |
last post by:
When users enter urls or other long strings it can destroy the
formatting of a page. A long url, posted in a comment, can cause page
distortions that make the page unreadable, till the website owner logs in
and deletes the comment. To protect against that, I'd like to break up
long strings in the comments (anything submitted by anonymous sources).
One thing I'd like to add to the following function is the ability to
break up long...
|
by: EBG |
last post by:
I have a simple email form on my site but getting screwy results because I
know alot of users are hitting "enter" instead of tab when doing the form.
When they hit enter the entire form is submitted whether it's finished or
not.
Is there an easy way to correct this?
My site only cares about IE.
|
by: Nobody |
last post by:
Heres the deal... I have an application where I have a list (as in a Windows
list control, but thats not important) displayed to the user. I sort this
list based on the list controls sort function (again, its not important that
its Windows) which ends up calling a compare function in my code:
int CompareFunc(char* str1, char* str2)
{
}
this function returns -1, 0 or 1 which gets passed on to the internal quick
|
by: MLH |
last post by:
In Access 97 and Access 2.0 applications, if a command button has the
focus, the spacebar will 'PRESS" the key. How does one go about
disabling this annoying BEATURE?
|
by: - Steve - |
last post by:
I've been given a school assignment and while everything else is easy
there's one topic I'm completley lost on.
I've been given an ASCII file that looks like this. During start-up, the
program needs to read an ASCII data file of inventory records and build an
appropriate dynamic data structure using structs and pointers.
10112 MICROPROCESSOR 2100 2 B 000008.50 000012.50
10235 CHARACTER_PRINTER 4013 4 C 000995.00 001295.00
10450...
| |
by: Fao |
last post by:
Hello, I am having some problems with inheritance. The compiler does
not not return any error messages, but when I execute the program, it
only allows me to enter the number, but nothing else happend. I think
the problem may be in my input function or in the main function.
If anyone out there can help me it woul be greatly appreciated.
Here is the code:
#include <iostream>
|
by: simonoficina |
last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button
object has a property called "default" that can set this button like
press "ENTER" key. But in the VB.net I can't find this property. Where
is it? Or mabye change the other thing,No?Thanks ! Simon
|
by: Sound |
last post by:
Enter space bar for field names and save the field.The field shoud not
get saved and an alert should be there as"Space bars are not allowed"
Add a field without giving any name and save the field.The field
should not get saved,and an alert should be there as "Field name is
mandatory"
|
by: bryant058 |
last post by:
#include<iostream>
#include<cstring>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
string s;
char *tokenptr;
int space;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |