Link to home
Start Free TrialLog in
Avatar of corno
corno

asked on

Why don't my mnemonic keys work?

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?
ASKER CERTIFIED SOLUTION
Avatar of Tommy Hui
Tommy Hui

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of corno
corno

ASKER

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?

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.

Avatar of corno

ASKER

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.

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.
Avatar of corno

ASKER

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