I need to be informed of how to use OnChar to change the character being typed. Basically, what I'm trying to do is modify the contents of my CEdit control - so that when I enter a postal code, I ensure that the user is entering the proper type of character at least.
Example J3H 4H8 (i.e., the format of Canadian postal codes are [letter, number, letter, space, number, letter, number]).
So if I'm in the 3rd position, after the H was just typed, I want to insert a space automatically.
but my class that overrides CEdit doesn't work as I expected. When I call CEdit::OnChar(-1,-1,-1), I still get the character that was typed in... (even CEdit::OnChar(-1,-1,-1)
void CValidatingEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
CEdit::OnChar(' ', 1, nFlags);
Of course this is not the code needed to do what I entered above - I just wanted a proof of concept that adding a space was possible and easy to do... To me, the above function should insert a space for any character that was pressed - but that's not what happens... How come?