Solved

Why don't my mnemonic keys work?

Posted on 1997-08-21
6
633 Views
Last Modified: 2013-11-20
I have created an application which has modeless dialog boxes. I have defined (in the resource editor) mnemonic keys for the various controls -- for example, &Close for a pushbutton that says "Close". Right now, when the dialog box has the focus (blue title bar instead of gray), pressing the mnemonic keys has absolutely no effect. Hitting tab to move among the controls also has no effect. My application also has a mainframe menu, with mnemonic keys defined (&File so that Alt-F brings up the File menu). These work.

Is there a reason for this seeming inconsistency?
0
Comment
Question by:corno
[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
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1304481
If you're using MFC, then make sure CWnd::PreTranslateInput is being called. That's the function that ultimately calls ::IsDialogMessage() for the dialog. ::IsDialogMessage() is the function that translates keystrokes for a dialog to do certain things.

If you are not using MFC, then you will need to modify your message loop to use ::IsDialogMessage().

0
 

Author Comment

by:corno
ID: 1304482
I am using MSVC4.2. I searched for PreTranslateInput in the Help database, and it can't find it. Apparently the function does not exist. There is something called PreTranslateMessage; is this what you mean?

0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1304483
Sorry, I was looking in VC 5.0. In Visual C++ 5.0, there are two functions: PreTranslateMessage and PreTranslateInput. In a dialog's PreTranslateMessage, it calls PreTranslateInput, so make sure your dialog's PreTranslateMessage is getting called.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:corno
ID: 1304484
I tried overloading my Dialog box's PreTranslateMessage like so:

BOOL SysSpewSystemDlg::PreTranslateMessage(MSG* pMsg)
{
      if (IsDialogMessage(pMsg))
      return TRUE;
   else
      return CWnd::PreTranslateMessage(pMsg);
}

It still doesn't work. Am I doing something wrong?

ps. if you feel the points for this question are not enough, I will increase them. I thought it would be relatively simple to solve.

0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1304485
At this point, I would try creating another dialog, but this time keep it as simple as possible. Does it work for you then? If it does not, then the problem is not in the dialog, but rather something else in the application preventing it from working. If it does, then the problem is in your dialog class and you need to find out what is different.
0
 

Author Comment

by:corno
ID: 1304486
I'm sorry. It still doesn't work. However, you provided me with some leads so I'm not going to reject this answer.

Thanks


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 71
Perl Awk Need Help 3 139
FizzBuzz challenge 9 85
Fibonacci challenge 11 138
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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