Prev: localhost
Next: How to subclass an MFC window?
From: David Webber on 25 Jun 2010 09:55 It's donkey's years since I used an acelerator table. (I long since developed my own methods used in response to WM_CHAR and WM_KEYDOWN.) However, now, with a new MFC application I am again trying to make accelerators work. In my accelarator table (edited with the resource editor) I have lines like VK_F1, ID_CONTEXT_HELP, VIRTKEY, SHIFT, NOINVERT and they seem to work. However "0", ID_NOTE0, ASCII, NOINVERT doesn't. In fact ASCII accelerators seem not to work quite generally. I am using the default PreTranslateMessage from CMDIFrameWndEx. Am I doing something daft? (BTW - what does NOINVERT do? The resource editor put it there.) Dave -- David Webber Mozart Music Software http://www.mozart.co.uk For discussion and support see http://www.mozart.co.uk/mozartists/mailinglist.htm
From: David Lowndes on 25 Jun 2010 11:31 >However, now, with a new MFC application I am again trying to make >accelerators work. In my accelarator table (edited with the resource >editor) I have lines like > > VK_F1, ID_CONTEXT_HELP, VIRTKEY, SHIFT, NOINVERT > >and they seem to work. However > > "0", ID_NOTE0, ASCII, NOINVERT > >doesn't. In fact ASCII accelerators seem not to work quite generally. I >am using the default PreTranslateMessage from CMDIFrameWndEx. > >Am I doing something daft? I've just tried adding an accelerator for key '0' in a default Win32 application (no MFC) for the About box menu item and it works fine. >(BTW - what does NOINVERT do? The resource editor put it there.) "By default, when an accelerator key corresponds to a menu item, the system highlights the menu item. You can use the NOINVERT flag to prevent highlighting for an individual accelerator." Dave
From: David Lowndes on 25 Jun 2010 11:47 >I've just tried adding an accelerator for key '0' in a default Win32 >application (no MFC) for the About box menu item and it works fine. It's OK in a sample MFC application as well. Dave
From: David Webber on 25 Jun 2010 12:47 "David Lowndes" <DavidL(a)example.invalid> wrote in message news:arj926d9fnr3n637tmf0rere0a8ra9ke5i(a)4ax.com... >>I've just tried adding an accelerator for key '0' in a default Win32 >>application (no MFC) for the About box menu item and it works fine. > > It's OK in a sample MFC application as well. I've just tried it in a sample which I created to explore things in - otherwise "untouched by me" - and it didn't work. So I created a *completely* new MFC MDI app - with as close as possible the same options - and it did :-( Thanks. I guess I'm going to have to step through till I get to TranslateAccelerator and see where they're going in different directions :-( [I did that with the existing app I'm working on and it wasn't obvious.] Dave -- David Webber Mozart Music Software http://www.mozart.co.uk For discussion and support see http://www.mozart.co.uk/mozartists/mailinglist.htm
From: Joseph M. Newcomer on 25 Jun 2010 15:34
Have you tried using an ASCII accelerator when the caret was in an edit control? I once heard that there were strange interactions with certain kinds of controls and accelerators. But I've never tried an ASCII accelerator and therefore have no experience in this area. joe On Fri, 25 Jun 2010 17:47:17 +0100, "David Webber" <dave(a)musical-dot-demon-dot-co.uk> wrote: >"David Lowndes" <DavidL(a)example.invalid> wrote in message >news:arj926d9fnr3n637tmf0rere0a8ra9ke5i(a)4ax.com... > >>>I've just tried adding an accelerator for key '0' in a default Win32 >>>application (no MFC) for the About box menu item and it works fine. >> >> It's OK in a sample MFC application as well. > >I've just tried it in a sample which I created to explore things in - >otherwise "untouched by me" - and it didn't work. > >So I created a *completely* new MFC MDI app - with as close as possible the >same options - and it did :-( > >Thanks. I guess I'm going to have to step through till I get to >TranslateAccelerator and see where they're going in different directions :-( > >[I did that with the existing app I'm working on and it wasn't obvious.] > >Dave Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm |