How to deal with accelerators for disabled controls?

Posted by sharptooth on Stack Overflow See other posts from Stack Overflow or by sharptooth
Published on 2009-07-13T05:48:55Z Indexed on 2010/04/08 21:13 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

I have a dialog created from a template. It has controls listed in the template in the following order:

  • some irrelevant controls
  • a label with an accelerator (let's pretend it's Alt-A)
  • an edit box
  • OK and Cancel buttons

Normally when I hit Alt-A the keybord focus is transferred to the edit box - just as needed. However I sometimes need to disable to edit box.

If I hit Alt-A when the edit box is disabled the effect is that the OK button is pressed and that is definitely not what I want. I would prefer to have no action taken in this case. What could I do to workaround this?

© Stack Overflow or respective owner

Related posts about Windows

Related posts about c++