Text editor in a nutshell

Subscribers:
7,250
Published on ● Video Link: https://www.youtube.com/watch?v=VDSxkCwlY60



Duration: 0:37
52 views
2


Yep. That is about it. Catch all the WM_CHAR messages that are translated from virtual key codes by TranslateMessage you call in your message loop. Append the character to your dynamic character array (I use custom string named "text"). Invalidate your client area. And just paint it in WM_PAINT. Detect backspace and remove character instead of adding it.

Yep. That's it. Shocking, isn't it? I was certainly for me. I was expecting this to be insanely hard thing to implement. Well well well...

P.S. Yes, of course that is many more "meat" to the full-fledged text editor. But no matter how big it is or how many features it support, it will still use exactly the same core mechanism displayed here!