Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionWhy can't I use OnKeyDown in a CDialog? Pin
alex5kov19-Sep-04 7:27
alex5kov19-Sep-04 7:27 
AnswerRe: Why can't I use onkeydown in a CDialog? Pin
Gary R. Wheeler19-Sep-04 15:01
Gary R. Wheeler19-Sep-04 15:01 
GeneralRe: Why can't I use onkeydown in a CDialog? Pin
alex5kov21-Sep-04 7:49
alex5kov21-Sep-04 7:49 
GeneralLinking issue with COM interface and Class IDs Pin
Alexander M.,19-Sep-04 7:21
Alexander M.,19-Sep-04 7:21 
GeneralRe: Linking issue with COM interface and Class IDs [edited] Pin
Michael P Butler19-Sep-04 10:34
Michael P Butler19-Sep-04 10:34 
GeneralRe: Linking issue with COM interface and Class IDs Pin
Michael Dunn19-Sep-04 11:38
sitebuilderMichael Dunn19-Sep-04 11:38 
GeneralOnKillfocus terminates application Pin
GWPATH19-Sep-04 5:44
GWPATH19-Sep-04 5:44 
GeneralRe: OnKillfocus terminates application Pin
Antti Keskinen19-Sep-04 7:06
Antti Keskinen19-Sep-04 7:06 
Is it a dialog-based application ?

If so, then pressing Enter is the same thing as clicking on the default button, which generally is Ok. What happens is that when you press Enter, the focus first moves from the edit box to the default button (thus firing the OnKillFocus event) and causes a click on the default button, thus terminating the application.

To fix this, change the default button of your application to something else. Alternatively, you can trap the enter keypress (WM_KEYDOWN event) or override the default OnOK handler, omitting the call to CDialog::OnOK, which will terminate the dialog.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: OnKillfocus terminates application Pin
GWPATH19-Sep-04 9:46
GWPATH19-Sep-04 9:46 
GeneralISAPI Site Sentry Filter Pin
raed19-Sep-04 4:16
raed19-Sep-04 4:16 
QuestionDBF file format description? Pin
Maer72719-Sep-04 3:16
Maer72719-Sep-04 3:16 
GeneralCListCtrl Icon custum drawing Pin
<marquee>Mourad DEBBAH<marquee>19-Sep-04 1:54
sussMourad DEBBAH19-Sep-04 1:54 
GeneralSelection State in Listcontrol Pin
Neelesh K J Jain19-Sep-04 0:55
Neelesh K J Jain19-Sep-04 0:55 
GeneralCreate a MDI app without child Frame Window on start Up Pin
ic@19-Sep-04 0:40
ic@19-Sep-04 0:40 
GeneralRe: Create a MDI app without child Frame Window on start Up Pin
ensger23-Sep-04 4:56
ensger23-Sep-04 4:56 
GeneralRe: Create a MDI app without child Frame Window on start Up Pin
Anonymous23-Sep-04 9:00
Anonymous23-Sep-04 9:00 
GeneralCRecordset::Edit() (mfc) Pin
010011011019-Sep-04 0:32
010011011019-Sep-04 0:32 
GeneralRe: CRecordset::Edit() (mfc) Pin
Manfred Staiger20-Sep-04 2:00
Manfred Staiger20-Sep-04 2:00 
QuestionHow to remove horizontal scrollar in a multiline edit control ? Pin
Member 20081719-Sep-04 0:27
Member 20081719-Sep-04 0:27 
AnswerRe: How to remove horizontal scrollar in a multiline edit control ? Pin
Member 20081719-Sep-04 1:55
Member 20081719-Sep-04 1:55 
GeneralConvert CString to TCHAR Pin
RedDragon2k19-Sep-04 0:01
RedDragon2k19-Sep-04 0:01 
GeneralRe: Convert CString to TCHAR Pin
010011011019-Sep-04 0:48
010011011019-Sep-04 0:48 
GeneralRe: Convert CString to TCHAR Pin
David Crow20-Sep-04 10:47
David Crow20-Sep-04 10:47 
GeneralRe: Convert CString to TCHAR Pin
Michael Dunn19-Sep-04 5:32
sitebuilderMichael Dunn19-Sep-04 5:32 
GeneralNeed Help! Using CBitmap Object Pin
Avinash Gupta18-Sep-04 23:48
Avinash Gupta18-Sep-04 23:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.