Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

CRichEditCtrl problem with SetDefaultCharFormat

$
0
0

I'm working on a (seemingly) small change to an old legacy application that my company developed years ago, and it involves casing issues in a RichEditCtrl.  For whatever reason, back when this application was first developed it was decided to make a custom control that inherits from a RichEditCtrl, but only allows users to enter text in all caps among other things.  However, now users would like to be able to enter text with normal capitalization in certain situations.

Since the CFM_ALLCAPS and CFE_ALLCAPS flags are set within one of the initialization functions, I decided to make a member function that could be called after the control is created and initialized to unset those flags.  This is what the relevant pieces of my code look like.

class CDkMemo : public CWindowImpl< CDkMemo, CRichEditCtrl > { protected: CHARFORMAT2 m_cfText; bool m_isAllCaps; ... public: void SetRegularCasing() { m_cfText.dwMask &= ~CFM_ALLCAPS; m_cfText.dwEffects &= ~CFE_ALLCAPS; m_isAllCaps = false; SetDefaultCharFormat(m_cfText); }

... };


After I made these changes I then called the SetRegularCasing function on one of these controls and then tried to type in the edit box, but my text was still being entered in all caps, even though the caps lock was off.  According to the MSDN documentation, after SetDefaultCharFormat is called, any new text entered should have those properties, but I can't get it to work.  Does anybody know what I'm doing wrong?

Thanks.


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>