I’m programming an application in MFC (don’t ask) and I have a CEdit box that holds a number. When that number is edited, I would like to act on the change, and then replace the caret where it was before I acted on the change – if the user was just before the ‘.’ in ‘35.40’, I would like it to still be placed before the dot if they change it to ‘345.40’. I’m currently catching the CHANGE message, but that can be switched to something else (UPDATE?). How can I accomplish this?
Share
Use the GetSel() function before your change to store the location of the cursor, then use SelSel() to set it back. You can use these functions to get/set the location of the caret, not just to get/set the selection the user has made.