Board index » cppbuilder » Cosmetic WordWrap - the help file lies

Cosmetic WordWrap - the help file lies


2007-04-01 04:05:59 AM
cppbuilder113
The Help file says about TRichEdit->WordWrap: "The wrapping is
cosmetic only--the text does not include any return characters that
were not explicitly entered. "
That means that the following program produces the same results in
both iterations of the for loop.
String s="";
int ww;
int ii;
for(ii=0;ii<1000;ii++)
s=s+"0123456789"; //create a very long string
for (ww=0;ww<2;ww++)
{
RichEdit1->WordWrap=(ww==0);
RichEdit1->Lines->Clear();
RichEdit1->Lines->Add(s);
output(RichEdit1->Lines->Count);
output(RichEdit1->Lines->Strings[1].Length());
}
Well, it produces: 278 36 3 4095
--
Jos?
 
 

Re:Cosmetic WordWrap - the help file lies

TRichEdit's can only handle lines up to 4095 characters long, before it
starts to chop them into separate lines, even with word wrap off. You are
adding a 10K line!
--
Mark Jacobs
www.jacobsm.com
 

Re:Cosmetic WordWrap - the help file lies

On Sun, 1 Apr 2007 18:30:53 +0100, "Mark Jacobs" < XXXX@XXXXX.COM >
wrote in borland.public.cppbuilder.vcl.components.using:
Quote
TRichEdit's can only handle lines up to 4095 characters long, before it
starts to chop them into separate lines, even with word wrap off. You are
adding a 10K line!
I know that, it's another flaw. But when WordWrap is on, it chops them
after 36 characters, while I'd expect the same 4095.
--
Jos?
 

{smallsort}

Re:Cosmetic WordWrap - the help file lies

Jos?< XXXX@XXXXX.COM >wrote:
Quote

[...] But when WordWrap is on, it chops them after 36
characters, while I'd expect the same 4095.
By chance, would that 36 characters be the same as a TextWidth
of the visible ClientWidth?
I don't know about TRichEdit but a TMemo with WordWrap set to
true will break it's Lines array according to how thay are
displayed on screen. IOW, change it's Width enough and you
can effectively change the Lines.
~ JD
 

Re:Cosmetic WordWrap - the help file lies

On 2 Apr 2007 03:38:50 -0800, "JD" < XXXX@XXXXX.COM >wrote in
borland.public.cppbuilder.vcl.components.using:
Quote
By chance, would that 36 characters be the same as a TextWidth
of the visible ClientWidth?
I think so.
But the help file says that WordWrap is purely cosmetic. In my opinion
there is only one way for a program to see whether Word Warp is on: by
testing the WordWrap property. Everything else should remain the same.
Perhaps the user sees many lines, but the program sees an entire
paragraph as a single line.
In reality, the program sees many lines too. This is not what the help
file tells.
Perhaps it is possible - I'll test it - to toggle WordWrap off, read
the contents of the contents, and toggle WordWrap on again for the
user's convenience.
--
Jos?
 

Re:Cosmetic WordWrap - the help file lies

Jos?< XXXX@XXXXX.COM >wrote:
Quote

[...] Perhaps it is possible - I'll test it - to toggle
WordWrap off, read the contents of the contents, and toggle
WordWrap on again for the user's convenience.
That may not be enough to get the control to reorganize the
lines. In any event, I'd suggest that you use the win32 API
SendMessage to send the control a WM_SETREDRAW message and
then change WordWrap and possibly it's Width, get the line,
change it back and finally send another WM_SETREDRAW message.
~ JD
 

Re:Cosmetic WordWrap - the help file lies

On 2 Apr 2007 11:41:27 -0800, "JD" < XXXX@XXXXX.COM >wrote in
borland.public.cppbuilder.vcl.components.using:
Quote
>[...] Perhaps it is possible - I'll test it - to toggle
>WordWrap off, read the contents of the contents, and toggle
>WordWrap on again for the user's convenience.

That may not be enough to get the control to reorganize the
lines.
Well, it works.
--
Jos?