I have a custom button class that is derived from the MFC CButton class. This class is an owner-drawn button who's functionality is very similar to the CBitmapButton class, but with some special enhancements.
The button paints correctly, responds to mouse clicks correctly, and I can 'Tab' to it corrrectly. For some reason, it will not respond to the 'Enter' key when it is the focused button in the tab order. When the custom button is focused and the 'Enter' key is pressed, the dialog closes and DoModal() returns. Strange.
I'm thinking that it has something to do with being owner-drawn because if you throw a standard MFC button on a dialog it responds to 'Enter' just fine.
What am I missing?
I've already thought about capturing the 'Enter' key and sending WM_LBUTTONDOWN message to my button if it is focused, but that leaves a real bad taste in my mouth -- it sounds like a sloppy work-around as opposed to the correct solution. Can somone please post the correct solution.