I am programming in C++ using MFC Document/View architecture. I have been trying to achieve something similar to MFC CEdit lose focus handler. I processed the message EN_KILLFOCUS as the answer suggests.
Basically, I'm doing this: I have text drawn in the view. When the users clicks the area of the text in the view, I position and show the CEdit window on top of it so users are able to edit the text. When the edit loses focus, I get the CEdit text and save it in the document. Then invalidate the view.
However, I seem to only receive the EN_KILLFOCUS message when the view loses focus. I have to click somewhere else, e.g. a docking window, or the toolbar, to make the CEdit lose focus. I want it to happen when I click anywhere else on the view, outside the CEdit box.
I am creating the CEdit with WS_CHILD style. I tried WS_POPUP but still the same problem.
Any help would be appreciated.