|
-
May 5th, 1999, 05:16 PM
#1
CRichEditCtrl Release Problem
Hello,
I am using a Rich Edit control on a dialog to display record information for
a simple record viewer used in a robots.txt generator I am writting in Visual C++ 6. I am
using the RichEdit control so I can make the field names (i.e. Bot Name a
different color from the rest of the text. Everything works as intended in
debug builds, but when I compile a release build all the text is black and
not the colors I specify. Here is part of the code I am using:
. . . some code precedes this...
CHARFORMAT cf;
COLORREF crFieldTitles = RGB(0,128,128);
COLORREF crNormalText = GetSysColor(COLOR_WINDOWTEXT);
iSel = m_BotList.GetCurSel();
if(iSel != LB_ERR)
{
iDBIndex = (int)m_BotList.GetItemData(iSel);
m_BotDatabase.GetRecord(iDBIndex);
m_RichBotInfo.GetDefaultCharFormat(cf);
cf.dwEffects = CFE_BOLD|TRUE;
m_RichBotInfo.SetWindowText("");
// Bot Name
cf.crTextColor = crFieldTitles;
m_RichBotInfo.SetWordCharFormat(cf);
m_RichBotInfo.ReplaceSel("Robot Name:");
cf.crTextColor = crNormalText;
m_RichBotInfo.SetWordCharFormat(cf);
m_RichBotInfo.ReplaceSel(" " + m_BotDatabase.m_strBotName);
... code goes on...
Thanks for any help,
Frank R.
-
May 6th, 1999, 02:06 PM
#2
Re: CRichEditCtrl Release Problem
If anyone has experienced this or knows what is wrong please help. I have posted to three seperate MFC message boards and am not getting any help at all. I have been through the MSDN documentation on the CRichEditCtrl and have tried changing the code some, but the problem persists! I don't know why it would work in Debug, but not Release mode, this stumps me the most.
-
May 6th, 1999, 10:39 PM
#3
Re: CRichEditCtrl Release Problem
Just a shot in the dark... The fact that it works in Debug mode but not Release mode sounds suspicious.
Try calling AfxInitRichEdit() in your app's InitInstance()
-
May 7th, 1999, 11:02 AM
#4
Re: CRichEditCtrl Release Problem
I am already calling AfxInitRichEdit() in the init instance of the program. The other features of the RichEdit seam to work, for instance SetBackgroundColor. This is however a dialog based application and the dialog this RichEdit is on is a modal dialog, does that make a difference?
-
May 9th, 1999, 02:54 PM
#5
Re: CRichEditCtrl Release Problem
The function your using formats only the current word in which the cursor (caret) is located. You need to do a setsel() and then format the selected text with one of the functions that does that.
-
May 11th, 1999, 03:44 PM
#6
Re: CRichEditCtrl Release Problem
I tried that as well and the text changes color in debug, but not release.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|