Search code examples
visual-c++conflictkey-bindingsaccelerator

MFC KeyPresses on Properties Docking Window being catched as other Control accelerators


I have a Visual C++ application where there are, among other things, a CListCtrl in the Main Frame and a Dockable Pane with a properties Window.

When I press the Delete key on the Properties Window, the application also understands it as "Delete selected item" of the CListCtrl.

Some similar behaviours occur for other keys.

How can I say that I don't want this to go also to the CListCtrl?


Solution

  • Ok, I made a PreTranslateMessage function in the Mainframe class, that puts the HACCCEL current accelerator table in a temporary variable when the input comes from the Properties Control or a descendent of it, then call the parent class PreTranslateMessage, and finally retake the original accelerator table in the end of this function.

    Now, I have another question: Is this the best solution? Doesn't seem to me it is!