Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending various languages to CRichEditCtrl

2 views
Skip to first unread message

Chris Shearer Cooper

unread,
Feb 9, 2007, 8:15:50 PM2/9/07
to
I have a CRichEditCtrl (and it is the RichEdit20A version) in an application
I am building in C++ in Visual Studio 2005.

I need this CRichEditCtrl to be able to display whatever I throw at it,
regardless of the language. If I send it English it's perfectly happy, but
if I send it Hebrew - first calling ModifyStyleEx(WS_EX_LTRREADING,
WS_EX_RTLREADING) and then sending it what looks like reasonable RTF to me
...

{\rtf1\ansi\ansicpg1255\deflang1037\rtldoc\lang1037\rtlch ,
\'E8\'F7\'F1\'F1}

while it displays Hebrew characters, it absolutely refuses to switch to
right-to-left mode.

I've seen various postings that seem to hint that this is a known bug with
CRichEditCtrl - can anyone verify this?

Thanks!
Chris


Mihai N.

unread,
Feb 9, 2007, 11:21:13 PM2/9/07
to
> I need this CRichEditCtrl to be able to display whatever I throw at it,
> regardless of the language. If I send it English it's perfectly happy, but
> if I send it Hebrew - first calling ModifyStyleEx(WS_EX_LTRREADING,
> WS_EX_RTLREADING) and then sending it what looks like reasonable RTF to me
> ...
>
> {\rtf1\ansi\ansicpg1255\deflang1037\rtldoc\lang1037\rtlch ,
> \'E8\'F7\'F1\'F1}
>
> while it displays Hebrew characters, it absolutely refuses to switch to
> right-to-left mode.
>
> I've seen various postings that seem to hint that this is a known bug with
> CRichEditCtrl - can anyone verify this?


The piece of RTF you posted is "reasonable RTF", but not "reasonable Hebrew
RTF" :-)
The RTF specs have special keywords to handle RTL features, just setting the
flags of the control have no effect.

Try this (added \rtlpar and \qr):
{\rtf1\ansi\ansicpg1255\deflang1037\rtldoc\lang1037\rtlpar\qr\rtlch
\'E8\'F7\'F1\'F1}


You can try the following:
- take the RTF spec and spend a lot of time understanding what is going on
there (and if you want to handle ANY language, is not going to be easy)
- forget the manually generated rtf and stuff the text in the control using
Windows messages (way easyer, but with a bit less control)

--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

0 new messages