Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to handle NM_RETURN in a dialog

Posted on 1998-04-10
2
Medium Priority
?
701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

722 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