Pressing ENTER in an edit box 
Author Message
 Pressing ENTER in an edit box

Hello everyone,

    I have a CFormView that has a series of edit boxes on it.  In one of
these, I want to catch the <ENTER> key being pressed so I can fill the other
boxes with information from a database.  I can't seem to catch it, though.
I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't have
it in front of me.).  Any ideas?

Harry J. Devine



Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
In properties for that box have you checked "want return"?


Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box

Quote:

>In properties for that box have you checked "want return"?

This will only work for a multiline edit.

_ _
o o   Jason Teagle
 <

Please ONLY respond via e-mail if you want to catch my attention - I don't
necessarily look at the newsgroups all the time.



Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box

Quote:

>Hello everyone,

>    I have a CFormView that has a series of edit boxes on it.  In one of
>these, I want to catch the <ENTER> key being pressed so I can fill the
other
>boxes with information from a database.  I can't seem to catch it, though.
>I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't
have
>it in front of me.).  Any ideas?

>Harry J. Devine


Override the form view's PreTranslateMessage(). You can then check to see:

    if (pMsg->message == WM_KEYDOWN && wParam == VK_ENTER)

and if so, set the value to return from PreTranslateMessage() to FALSE to
make sure the message is passed on - then your WM_KEYDOWN trap will work.
Alternatively, when you detect this message just call your update routine
directly.

Does this help?

_ _
o o   Jason Teagle
 <

Please ONLY respond via e-mail if you want to catch my attention - I don't
necessarily look at the newsgroups all the time.



Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
Catch the IDOK inside the OnCommand() function or WM_COMMAND message.  It's
on the wParam (first parameter).

John

Quote:

>Hello everyone,

>    I have a CFormView that has a series of edit boxes on it.  In one of
>these, I want to catch the <ENTER> key being pressed so I can fill the
other
>boxes with information from a database.  I can't seem to catch it, though.
>I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't
have
>it in front of me.).  Any ideas?

>Harry J. Devine




Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
This question is probably the most asked question in
this newsgroup. Dialogs (and FormViews I think)
handle ENTER and ESC differently from most windows.
Your best bet is to add an override of PreTranslateMessage
and catch it there (as a WM_KEYDOWN). Dont pass it
on to the base class or it will destroy the dialog. - Doug S.
Quote:

> Hello everyone,

>     I have a CFormView that has a series of edit boxes on it.  In one of
> these, I want to catch the <ENTER> key being pressed so I can fill the other
> boxes with information from a database.  I can't seem to catch it, though.
> I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't have
> it in front of me.).  Any ideas?

> Harry J. Devine




Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
read
How to Disable Default Pushbutton Handling for MFC Dialog
Last reviewed: October 10, 1997
Article ID: Q122489
1.00 1.50 | 1.00 2.00 4.00
http://support.microsoft.com/support/kb/articles/q122/4/89.asp

--
----------------------------------------
Rajesh Parikh
Microsoft Certified Solution Developer

remove  nospam_  from the email address
----------------------------------------

Quote:

>Hello everyone,

>    I have a CFormView that has a series of edit boxes on it.  In one of
>these, I want to catch the <ENTER> key being pressed so I can fill the
other
>boxes with information from a database.  I can't seem to catch it, though.
>I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't
have
>it in front of me.).  Any ideas?

>Harry J. Devine




Sat, 31 Mar 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
Hello again, everyone,

    I think that my last question caused some confusion, so I'd like to try
and clear it up.  My application is based on a CFormView, however, it
doesn't close when I press ENTER in my edit box.  It doesn't do anything!!!!
I want to perform an action when the ENTER key is pressed, I just can't find
out WHEN it was pressed.  Should I still try PreTranslateMessage or some
other means?

Hope this clears things up.
Harry J. Devine

Quote:

>Hello everyone,

>    I have a CFormView that has a series of edit boxes on it.  In one of
>these, I want to catch the <ENTER> key being pressed so I can fill the
other
>boxes with information from a database.  I can't seem to catch it, though.
>I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't
have
>it in front of me.).  Any ideas?

>Harry J. Devine




Mon, 02 Apr 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
well for the edit box properties do you have want return selected?


Mon, 02 Apr 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
But I am not using a dialog.  I would think that the default pushbutton
handling would close the CFormView, but it doesn't.  Can you clear this up?

Thanks,
Harry

Quote:
>read
>How to Disable Default Pushbutton Handling for MFC Dialog
>Last reviewed: October 10, 1997
>Article ID: Q122489
>1.00 1.50 | 1.00 2.00 4.00
>http://support.microsoft.com/support/kb/articles/q122/4/89.asp

>--
>----------------------------------------
>Rajesh Parikh
>Microsoft Certified Solution Developer

>remove  nospam_  from the email address
>----------------------------------------

>>Hello everyone,

>>    I have a CFormView that has a series of edit boxes on it.  In one of
>>these, I want to catch the <ENTER> key being pressed so I can fill the
>other
>>boxes with information from a database.  I can't seem to catch it, though.
>>I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't
>have
>>it in front of me.).  Any ideas?

>>Harry J. Devine




Mon, 02 Apr 2001 03:00:00 GMT  
 Pressing ENTER in an edit box
I just wanted to let everyone know that I found a solution for this problem.
Believe it or not, I found it on Microsoft's Knowledge Base.  The solution
was in an article called "How to Trap Arrow Keys in an Edit Control of a
Dialog Box".  What I had to do was, in my CEdit-derived class, override
WM_GETDLGCODE.  My overriden function looked like this:

UINT CUnitNumEdit::OnGetDlgCode()
{
 return DLGC_WANTALLKEYS;

Quote:
}

Now, when I press ENTER, my code responds to it and I can go from here.
Just wanted to let you all know in case anyone had the same type of problem.
Thanks for all the help.

Harry

Quote:

>Hello again, everyone,

>    I think that my last question caused some confusion, so I'd like to try
>and clear it up.  My application is based on a CFormView, however, it
>doesn't close when I press ENTER in my edit box.  It doesn't do
anything!!!!
>I want to perform an action when the ENTER key is pressed, I just can't
find
>out WHEN it was pressed.  Should I still try PreTranslateMessage or some
>other means?

>Hope this clears things up.
>Harry J. Devine


>>Hello everyone,

>>    I have a CFormView that has a series of edit boxes on it.  In one of
>>these, I want to catch the <ENTER> key being pressed so I can fill the
>other
>>boxes with information from a database.  I can't seem to catch it, though.
>>I have tried WM_KEYDOWN and WM_SYSKEYDOWN (something like that, I don't
>have
>>it in front of me.).  Any ideas?

>>Harry J. Devine




Tue, 03 Apr 2001 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. press enter in an edit box and make it happen in an other edit box too

2. press Enter in a Edit box and make it happen in another box at the same time

3. Press enter in edit box?

4. Enter pressed in an edit box

5. Bell sound when ENTER is pressed in an EDIT control child of an ATL control

6. Pressing enter in combo box

7. pressing ENTER in CEdit box

8. Why pressing Enter key closes my dialog box?

9. Pressing Enter in Dialog Box

10. How to prevent my modal dialog box from destruction when I press enter

11. How to prevent my modal dialog box from destruction when I press enter

12. Handling the User Pressing Return in Edit box

 

 
Powered by phpBB® Forum Software