Solved

How to handle NM_RETURN in a dialog

Posted on 1998-04-10
2
654 Views
Last Modified: 2013-11-20
It appears that NM_RETURN never gets sent if a list control is embedded in a dialog.  NM_DBLCLK definitely gets called, but NM_RETURN, when the focus is on an item in the list control never gets fired.  The only thing that gets fired is the default button handler.  I believe that the message never gets fired because I have tried to capture the message in pretranslate and it never captured the message.
0
Comment
Question by:falkland
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1317607
Correct, the new controls (treeview and listview) don't appear to follow correct dialog controls semantics. They are really designed to be in a window and not in a dialog. To get around this problem, you need to set the default ID to a hidden button. The hidden button will be clicked when the user presses the return key. This function can tell if the focus came from the list control (through WM_SETFOCUS), if it is, then you can do whatever you like. Otherwise, you can then simulate the Ok button being pressed.

0
 

Author Comment

by:falkland
ID: 1317608
if (GetDlgItem(IDC_LIST)==SetFocus())
  OnOK();
else
  OnSearch();

Did the trick!!  This code was placed in the bn_clicked handler for the hidden button.
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

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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

20 Experts available now in Live!

Get 1:1 Help Now