Ignore keyboard input

Hi

How can I ignore non numeric character input into an Edit box control

I am looking around the region of OnKeydown and OnKeyup functions added by Class wizzard and changing the Keycode passed in, but this doesnt work

Any ideas anyone 

Thanks


0
anonymous (74722)
1/19/2004 11:51:12 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
273 Views

Similar Articles

[PageSpeed] 35

Try the ENCHANGE event.  You could also set the edit box to numeric-only 
with the class wizard.  The latter, unfortunately, doesn't make 
allowances for decimals, signs, etc.

Balboos

Jon Bishop wrote:

> Hi,
> 
> How can I ignore non numeric character input into an Edit box control.
> 
> I am looking around the region of OnKeydown and OnKeyup functions added by Class wizzard and changing the Keycode passed in, but this doesnt work.
> 
> Any ideas anyone ?
> 
> Thanks.
> 
> 

0
balboos (139)
1/19/2004 12:49:43 PM
"Jon Bishop" <anonymous@discussions.microsoft.com> wrote in message
news:8EE7D7ED-5CB0-40E5-B672-47B8466C1BE5@microsoft.com...
> Hi,
>
> How can I ignore non numeric character input into an Edit box control.
>
> I am looking around the region of OnKeydown and OnKeyup functions added by
Class wizzard and changing the Keycode passed in, but this doesnt work.
>
> Any ideas anyone ?
>
> Thanks.
>
>

EN_UPDATE event happens before the text is displayed, but when the value of
CEdit is retrievable by UpdateData(). So, create that event handler, and do
something like

UpdateData();

if (m_str == "0" || m_str == 1 ... )
    return;

m_str = "";
UpdateData(FALSE);

I personally don't like to set the control's style to accept only numbers.
If your users accidentally presses non numeric key while the edit control
has input focus, they'll get some silly message box asking them to enter
numbers only.


0
spam1 (174)
1/19/2004 2:44:08 PM
"Jon Bishop" <anonymous@discussions.microsoft.com> wrote in message
news:8EE7D7ED-5CB0-40E5-B672-47B8466C1BE5@microsoft.com...
> Hi,
>
> How can I ignore non numeric character input into an Edit box control.
>
> I am looking around the region of OnKeydown and OnKeyup functions added by
Class wizzard and changing the Keycode passed in, but this doesnt work.
>
> Any ideas anyone ?

Intercept WM_KEYDOWN messages in PreTranslateMessage, and return TRUE when
you wish to discard of the message. If you don't let the superclass handle
it.

Tom.

> Thanks.
>
>


0
1/19/2004 2:50:18 PM
Reply:

Similar Artilces:

Change short keyboard
Hello there I created new procedure instead of sp_help can i change the behavior of Alt+F1 so it can call to my procedure and not for sp_help? ...

how do I ignore certain lines
Hi I have a list of times and figures I add up and average for my bike riding but the odd line I want to ignore for certain reasons. Not to sure what to use but I have column b and if I want to ignore this line I want to put a "y" in it. The sheet is synced with a PDA so the commands have to work on excel mobile. I know sumproduct does not work on the PDA, any advise is welcome. Thanks Jon Do =sumif() and =countif() work on your PDA? If not how about just using another column: =if(b1="y","skip",a1) =average() in excel will ignore the cells with text ...

How to ignore hidden columns in an "Average" formula?
If an "average" formula includes multiple columns, and those columns change each month by hiding old months (at end) and adding new months (at beginning) what can be done, by macro or in formula) to ignore the hidden columns? Try this if you can use 101 in your Excel version =SUBTOTAL(101,A1:C1) -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "DotK" <DotK@discussions.microsoft.com> wrote in message news:D6F36A22-BDE4-4836-98AE-028A616A9300@microsoft.com... > If an "average" formula includes multiple columns, and thos...

Button Wizard:RunQuery ignores delete queries?
If I put a button on a form, choose misc, run query, I get a list of queries that does not include any delete queries. Why is that? It is easy enough to get around, but why? Don't have an answer for you, other than to confirm that delete queries are not presented in the list of queries.... ACCESS has been this way for a number of versions, for some reason. -- Ken Snell <MS ACCESS MVP> "Phil Smith" <phil@nhs-inc.com> wrote in message news:OjpW0tg1HHA.1100@TK2MSFTNGP06.phx.gbl... > If I put a button on a form, choose misc, run query, I get a list...

Multply F4 from input at A1
Example A1 is number of pieces, F4 is total. I have all the formulas figuared out but this one: A1= # 0f pieces B1is width C1is height D1is the answer/144 witch gives me the sq ft e1 is cost pr sq ft f1 adds tax g1 gives total $ amount Better example: I can e-mail you what I have if needed to assist. I need this verry quickly, so please hels ASAP Thanks Mike Sorry for post several times post a sample of what you have and what you want to achieve to clarify things better. -- Hope this is helpful Pls click the Yes button below if this post provide answer you have asked Thank You cheer...

HID Input Service keeps turning off
I've been using Win XP Media Center Edition 2005 w/ Rollup 2 for years without too much difficulty. But, there is one thing that has been driving me crazy and that is the HID Input Service. I have Microsoft's IR Receiver and Remote Control ( Model 1040 ) and when the HID Input Service is running everything is just dandy. However, the service turns itself off arbitrarily and quite regularly. Instance 1: Whenever a DVD is placed in the drive, the HID Input Service disables itself and I have to manually restart it from the SERVICE section. Instance 2: Upon rebooting th...

text field with input mask
Hi all,I have a text field with field size of 6, input mask of &99.99. So it is ok for me to data entry data like E55.66, or 777.88. Now I need enter E123.45. If I change it to field size 7 and input mask of C999.99, I can enter E123.45, but all of my old data will be wrong. What should I do to keep all the old data right and also be able to enter my now data?Thanks,Blinda "Blinda" wrote:> Hi all,> > I have a text field with field size of 6, input mask of &99.99. So it is ok > for me to data entry data like E55.66, or 777.88. > > Now I need enter E123.45. If...

Is there Keyboard shortcut to print single page (Current Page)?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Is there a Keyboard shortcut to print single page (Current Page)? <br><br>In Windows, this would be &quot;control P&quot; and then &quot;ALT E&quot; which also works in Powerpoint for Windows. <br><br>Is there a way to do this in Word? Is see the button in the dialog box, but I'd like to be able to do it from the keyboard without moving to the mouse. <br><br>Any suggestions? <br> Thanks. As you've probably discovered Option+E doesn't perfo...

How to prevent CRichEditView from input?
I use a CRichEditView to show some message, so I want to preven it from customer input. My original solution is to terminate KEY_UP message from PreTranslateMessage(), but I find that I cannot use "ctrl-C" to copy content from it yet. So is there any other method to just prevent it from user input and paste but still can use ctrl-c to copy content? You can just set the richedit ctrl as read only. GetRichEditCtrl().SetReadOnly(TRUE), Ctrl+C will also work. -VSP "music4" <music4@163.net> wrote in message news:#VdMga8TGHA.4452@TK2MSFTNGP12.phx.gbl... > I use a CR...

Test Mail...Please Ignore #11
Testing NNTP Client, Please ignore message Thanks ...

Getting input from and Sending output to another thread's window
Originally there was client software that I wanted to write a program to mimic. However, that will be too difficult I discovered because I don't know the details of how the software communicates with the server. So what I want to do now is simply open the original client, but write a program to automate what the client software does. So my question is, is there a way I can monitor what messages the client software's windows are receiving? And can I tell my program to simulate mouse clicks on certain buttons that are in a window belonging to a thread other than my own (e.g. in the c...

Keyboard shortcut to mark as reconciled
Now correct me if I am wrong, but aren't the keyboard shortcuts supposed to work in Money 2007? I would have sworn they did in 2006, such as "R" to mark as reconciled. The only one I can get to work is Ctrl+M to mark as cleared. -- LJ My Best Friend Is My Wife!! I tried it once, thought I saw it, and was going to write: ----- Ctrl+Shift+M seems to be broken here as well. Can't say whether this is supposed to work and is broken on accident or if somebody really thought this was a necessary improvement. ----- But, "upon further review", it does seem to work a...

using VBA to set a keyboard option setting
Is there a way I can get VBA (Access 2003) to set a keyboard option setting on the desktops of all users of an application? I would like to set the "Behavior entering field" setting in the Tools-Options-Keyboard (tab) dialog set to "Go to end of field", and I would like to do it using VBA. Is there a way to accomplish this? Thanks in advance, Paul Paul wrote: >Is there a way I can get VBA (Access 2003) to set a keyboard option setting >on the desktops of all users of an application? > >I would like to set the "Behavior entering f...

Timezone ignored in GetLocalTime?
Hi, I developed a program which reads the system time using GetLocalTime and displays it. As far as I understand it, the time should always correspond with the time which is displayed in the taskbar. At least this is the behavior I get on most machines. I got one XP machine, however, where GetLocalTime always seems to read GMT, regardless of the timezone-setting. Any ideas? The code I use is as follows: SYSTEMTIME st; TCHAR szDate[32]; GetLocalTime (&st); GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szDate, NUM_ELEMENTS(szDate)); Thanks, Sparhawk Are...

Formatting for credit card number input
I have a cell in which the user will input a credit card number and I want it to display a format based on the type of card. So Visa / MC should be "#### - #### - #### - ####" but Amex should be "####-######-#####" - the user will choose the type of card in another cell so what's the most effective way to conditionally format the input to display properly based on the card type? Excel's maximum precision is 15 digits. So to handle 16 digits, you need to use text, not numbers. Therefore formatting will not help you. You can format with a formula somet...

Copying field inputs
How can I copy an input from one field into another field? Bob Field 1 is A1 Field 2 is B1 In B1 enter =A1 Whatever you enter in A1 will be shown in B1. Gord Dibben Excel MVP On Wed, 23 Feb 2005 10:01:02 -0800, "BobR" <BobR@discussions.microsoft.com> wrote: >How can I copy an input from one field into another field? ...

Phone Number Input Mask 08-10-07
Hi. I tried editing the input mask property for my PhoneNumber field without success. I want the input mask to be: 999-999-999 - no parenthesis, just the dashes as placeholders. "JamesJ" <jjy@adelphia_darwin.net> wrote in message news:e7ONHm02HHA.3900@TK2MSFTNGP02.phx.gbl... > Hi. I tried editing the input mask property for my > PhoneNumber field without success. > I want the input mask to be: > 999-999-999 - no parenthesis, just the dashes as placeholders. > > How about: 000\-000\-0000 -- Smitty Somerset, PA Worked like champ. Thanks much &...

Form input to be Negative
Any help on how to make the form input to always show negative with brackets around it. From Access 2003 Help (Press F1 with focus in the Format property, select "Number and Currency Data Types", scroll to bottom of page): Setting 0;(0);;"Null" Description Display positive values normally; display negative values in parentheses; display the word "Null" if the value is Null. If you do not want the word "Null" displayed, then use this format: 0;(0) Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ ___...

Outlook 2007 Ignoring Mail Format Configured for Contact
I need to send emails to a particular internet recipient (i.e., not in exchange) in Plain Text. I attempted to configure this in the following ways: Attempt 1: 1) Open Contact window 2) Double click Email... field under Internet section 3) Set Internet format to "Send Plain Text only" Attempt 2: 1) Open Contact window 2) Right click Email... field under Internet section 3) Select Send Option... 4) Check "I want to specify the format..." 5) Select "MIME" -> "Plain Text" Attempt 3: 1) Same as steps 1-4 in Attempt 2 2) Select "P...

Want Input boxes to accept unicode strings on Standard Windows XP
I have a MFC application that is currently built with MBCS mode. If I run the program on a Chinese OS (Windows XP), the input boxes (Edit Controls) can accept Chinese chars and display correctly. If I run it on a standard English XP, the input boxes won't accept Chinese chars (display as "????") -- please note that I have already installed CKJ on the system and IE and Outlook can display Chinese correctly. Is this just because of different MFC libraries used for the application? Can I force the application running on Standard XP to use the unicode libraries so ...

Num Lock on Keyboard
New problem just started and don't know why. When I boot up my PC, the "num lock" light was always automatically on, allowing me to use the numeric keys. It wont come on automatically any more. I have to turn it on manually evry time I boot up the PC. What has caused this change and how can I get it back to what it used to do. Thank you. Tony On Tue, 2 Feb 2010 09:18:05 -0800, Omaha Tony <OmahaTony@discussions.microsoft.com> wrote: >New problem just started and don't know why. When I boot up my PC, the "num >lock" light was alway...

Mark Cells for input data
I want to know if there is a way to mark the cells that the user need t input data, color it but I don't want to print that cells with color -- Message posted from http://www.ExcelForum.com Hi 1) Fill the cells you want to mark with the colour you want if you have not already done so. 2) Select "File>Page Setup" and then select the "Sheet" tab. 3) Place a check mark in the box "Black and White". This setting will print the entire sheet in black and white. -- XL2002 Regards William willwest22@yahoo.com "elliot315 >" <<elliot315.1...

How can I make graphics with 5 inputs in Excel 2003?
I would like to make a x-y chart with multiple inputs. So far, I only could get until 2 inputs. ...

Input period, but get .+
When typing entries in an EXCEL cell, I want to end the sentence with a period. However, a plus sign appears after each period and I have to go back and delete it. It's only been happening the last couple of weeks, but I don't understand why. Did I inadvertently change something in the formatting? Cameron :confused: -- Cameronsmi ------------------------------------------------------------------------ Cameronsmi's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24491 View this thread: http://www.excelforum.com/showthread.php?threadid=380882 Check y...

Tabbing into continuous subform ignores the first control
When I tab into the subform, from the last position in the main form, the focus moves to the second control in the continuous subform except on the first record entered in a session. I shift+tab back to the first control and the tabbing is normal from then on until the next record gets to the subform. The order of the controls on the subform is the same as the fields in the underlying table and the effect is the same in Datasheet view (of the subform). This first control on the subform is a combo box if that effects anything. Is there a way to get the tabbing right? ern. No, I thought the...