Solved

Message Processing

Posted on 1998-09-03
4
330 Views
Last Modified: 2013-11-20
This should be easy.

I have an MDI MFC application.  The view is a CFormView
with Buttons, EntryFields, and ComboBoxes.  The default
behavior is to go to the next control in the tab order
when the Tab key is hit.  I want the same behavior when
Enter (or Return) key is hit.

This is not a CDialog it is a CFormView.

I have tried registering all sorts of message
handlers that should work, but none of them
get executed (OnChar, OnKeyDown, OnSysKeyDown,
OnNotify...).

Help!
0
Comment
Question by:solomon021499
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
prasanth earned 200 total points
ID: 1321691
I would try overriding PreTranslateMessage and processing WM_KEYDOWNs where the virtual key is VK_ENTER.
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1321692
The easiest way i think is to add a default 'IDOK' button to your form view.
It may be invisible - so it won't affect your layout. Then add a handler:

void CMyFormView::OnOK()
{
  int curID=GetDlgCtrlID(GetFocus());
 
  if( // check if curID is one of your edit fields //)
    SetFocus( GetNextDlgTabItem(GetFocus()) );
}
0
 

Author Comment

by:solomon021499
ID: 1321693
prasanth's proposed answer is the way to go.

Unfortunately, snoegler's comment will work for CDialogs, but not CViews.

Thanks
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1321694
Please don't think that this is against you - but it does work.
We've been using this in a project, and it worked :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 50
ORA-01403: no data found 43 83
either24  challenge 19 84
tripleUp challenge 7 67
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now