VC++ CGridCtrl, CEditBox, & Enter Key
Posted on 1997-07-09
ENVIRIONMENT: MFC MDI program in VC++4.2
WHAT NOW WORKS: A CGridCtrl in a form view shows a set of numbers. When a grid cell is double-clicked, the cell is overlain with a properly-sized CEditBox containing the number, and the number can be edited. When the edit box loses the focus, the edited number is verified, the edit box disappears, and the number is replaced in the grid cell. I am using OnDoubleClick to get into the edit mode and OnKillFocus to get back out just because they were the only ways I could think of to do it.
THE PROBLEM: How can I get into the edit mode by pressing Enter or a number key (instead of a double-click), and get back out of the edit mode by pressing Enter (instead of clicking the mouse somewhere else)? [I'm pretty fuzzy about the details of message routing and trapping keystrokes.] TIA.