I have a few questions about using the rich edit control. I want the user to have the option of a word wrap mode. If word wrap is on I have been declaring the window without WS_HSCROLL and ES_AUTOHSCROLL. Is there a way to change the style after the window has been created? This way I can add or get rid of these styles as the word wrap option changes.
I want to create a right click popup menu. I was thinking of subclassing the rich edit control, but I am not sure if this is the right way to go. If I do subclass, does the richedit recieve the WM_RBUTTONUP message? I tried this but it did not seem to work.
As far as changing the word wrap stuff. That is quite simple, actually. It took me a bit of searching some months back and discovered that the m_nWordWrap member of a CRichEditView has 3 possible values:
Set the member variable m_nWordWrap to the new value then call:
WrapNone, WrapToWindow, WrapToTargetDevice
As far as the right click context menu, check out this function:
Here is an example of this function overridden:
virtual HMENU GetContextMenu(WORD seltype, LPOLEOBJECT lpoleobj,CHARRANGE* lpchrg);
However, I just realized this is for a CRichEditView, but not a ctrl. Well, hope it helps somewhat.
HMENU CLogViewView::GetContextMenu(WORD seltype, LPOLEOBJECT lpoleobj,CHARRANGE* lpchrg)
CRichEditCntrItem* pItem = GetSelectedItem();
if (pItem == NULL || !pItem->IsInPlaceActive())
CMenu* pMenuPopup = menuText.GetSubMenu(0);
Thanks for the reply. I forgot to tell you that I am using C and WinAPI. Thanks anyway. Does anyone else know how to do these things?