From: neelagain on 5 Feb 2007 07:11 Thanks Joe. Let me start with the last question - I have to create rich edit at runtime because I dont have access to dialog template at design view. The spaces and ES_OEMCONVERT was something that I overlooked, thanks. I knew about StreamIn & StreamOut and thats what I ended up using (I had already tried that in one more rich edit). But I have also experienced that if you create the rich edit control at design time then the code I put together does work. I am pretty much sure that this difference is to do with the fact that using SetWindowText we cannot specify that the content is UNICODE characters (which can be done using SF_UNICODE) in StreamIn/Out. I think I even tried EM_SETTEXTEX but that didnt work either. And all this only when I create the control at runtime. There is an article in MSDN which mentions that CRichEditCtrl always creates RichEditA object even though you compile the project with UNICODE. Can that be the reason? I dont know but I would certainly want to know. Thanks, Neel. On Jan 1, 10:12 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote: > SetWindowText has nothing to do with rtf formatting. You have to use the StreamIn and > StreamOut methods to get rtf conversions. > > Why are you using ES_OEMCONVERT? And why aren't you putting spaces around the | operators > to make yhour code readable? And, for that matter, why are you creating it at runtime? > joe > > On 29 Dec 2006 08:55:26 -0800, neelag...(a)hotmail.com wrote: > > > > > > >Hi, > > >I have created a CRichEditControl on one of the dialogs > >programmatically - > > >pRichCtrl->Create( > >WS_CHILD|WS_VISIBLE|ES_READONLY|ES_MULTILINE|ES_OEMCONVERT > >, rect , this , uiCtrlId) > > >Now I want to be able to use rtf format to format the text but even > >simplest rtf format wont work - > > >strTxt = "{\\rtf1\\ansi This is in \\b bold\\b0.}"; > > pRichCtrl->SetWindowText( strTxt ) ; > > >I am compliing with UNICODE defined. Wherever I have CRichEditControl > >on the dialog template, this kind of formattin works fine. Can someone > >help ? > > >Thanks in advance, > >Neel. > > Joseph M. Newcomer [MVP] > email: newco...(a)flounder.com > Web:http://www.flounder.com > MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text - > > - Show quoted text -
From: MikeBz on 5 Feb 2007 11:44 I've just come up against this problem too, having converted my app to Unicode. I have a window which encapsulates a CRichEditCtrl into which I put strings from string resources. Having to use StreamIn() for this is pretty clunky. Any ideas/solutions gratefully received! Mike "neelagain(a)hotmail.com" wrote: > Hi, > > I have created a CRichEditControl on one of the dialogs > programmatically - > > pRichCtrl->Create( > WS_CHILD|WS_VISIBLE|ES_READONLY|ES_MULTILINE|ES_OEMCONVERT > , rect , this , uiCtrlId) > > Now I want to be able to use rtf format to format the text but even > simplest rtf format wont work - > > strTxt = "{\\rtf1\\ansi This is in \\b bold\\b0.}"; > pRichCtrl->SetWindowText( strTxt ) ; > > I am compliing with UNICODE defined. Wherever I have CRichEditControl > on the dialog template, this kind of formattin works fine. Can someone > help ? > > Thanks in advance, > Neel. > >
From: MikeBz on 6 Feb 2007 05:59 I should emphasise that it worked fine (using CRichEditCtrl::SetWindowText() to display RTF) before the app was Unicode. Mike "MikeBz" wrote: > I've just come up against this problem too, having converted my app to > Unicode. I have a window which encapsulates a CRichEditCtrl into which I put > strings from string resources. Having to use StreamIn() for this is pretty > clunky. Any ideas/solutions gratefully received! > > Mike > > "neelagain(a)hotmail.com" wrote: > > > Hi, > > > > I have created a CRichEditControl on one of the dialogs > > programmatically - > > > > pRichCtrl->Create( > > WS_CHILD|WS_VISIBLE|ES_READONLY|ES_MULTILINE|ES_OEMCONVERT > > , rect , this , uiCtrlId) > > > > Now I want to be able to use rtf format to format the text but even > > simplest rtf format wont work - > > > > strTxt = "{\\rtf1\\ansi This is in \\b bold\\b0.}"; > > pRichCtrl->SetWindowText( strTxt ) ; > > > > I am compliing with UNICODE defined. Wherever I have CRichEditControl > > on the dialog template, this kind of formattin works fine. Can someone > > help ? > > > > Thanks in advance, > > Neel. > > > >
From: David Ching on 6 Feb 2007 08:11 <neelagain(a)hotmail.com> wrote in message news:1167413053.387983.252770(a)n51g2000cwc.googlegroups.com... > > (from previous message) > >strTxt = "{\\rtf1\\ansi This is in \\b bold\\b0.}"; > pRichCtrl->SetWindowText( strTxt ) ; > > After call to SetWindowText RichEditCtrl shows the text as below (just > removes the escaped backslashes).. > > {\rtf1\uc1 This is in \b bold\b0.} > > How did this compile? If the app is UNICODE, don't you need to say: strTxt = _T("{\\rtf1\\ansi This is in \\b bold\\b0.})"; // need to add _T() Further, the result seems to indicate the RichEditCtrl parsed some of the text successfully (it got the first part, with "\rtf1") right. So whatever the format of the string you passed it, it at least worked that far. But look... what if you replaced "\\rtf1\ansi" with "\\rtf1\unicode"? I don't know if that's valid RTF, but I don't think you should be specifying "Ansi" when it's a "Unicode" string. I tried to use the built-in Windows Write application to generate a document with RTF and save in Unicode, but guess what? Write didn't have an option to save Unicode RTF! I guess if you choose RTF it's always Ansi. The only way to save Unicode is to save in text format. Good luck, David (MVP)
From: David Ching on 6 Feb 2007 08:21 "David Ching" <dc(a)remove-this.dcsoft.com> wrote in message news:o8%xh.52651$QU1.3841(a)newssvr22.news.prodigy.net... >>strTxt = "{\\rtf1\\ansi This is in \\b bold\\b0.}"; >> pRichCtrl->SetWindowText( strTxt ) ; >> >> After call to SetWindowText RichEditCtrl shows the text as below (just >> removes the escaped backslashes).. >> >> {\rtf1\uc1 This is in \b bold\b0.} >> > But look... what if you replaced "\\rtf1\ansi" with "\\rtf1\unicode"? I > don't know if that's valid RTF, but I don't think you should be specifying > "Ansi" when it's a "Unicode" string. > Seems the RichEditCtrl specified "\rtf1\uc1"... maybe "uc1" means Unicode. So try altering strTxt = "{\\rtf1\\uc1 This is in \\b bold\\b0.}"; // replace "ansi" with "uc1" Good luck, David (MVP)
|
Next
|
Last
Pages: 1 2 3 Prev: size of Picture Control Next: WinDbg: Heap corruption detected at 01864DC8 |