Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 16 of 16 total
Thread MultiEdit Line Count
Fri, Mar 16 2018 4:26 PMPermanent Link

erickengelke

Avatar

Coullie wrote:

Walter Matte wrote:

<You mean:   MultiLineEdit1.lines.count - 1>

:Yup sorry Walter. My question is still the same. Why no line count.

You're so close...

I would recommend setting
  MultiLineEdit1.LineSeparator = #10
probably before you read in the text.  Then after reading the text, the count should be what you expect because you and EWB will be agreeing on using #10 as the end of line separator.


Erick
http://www.erickengelke.com
Fri, Mar 16 2018 9:03 PMPermanent Link

Raul

Team Elevate Team Elevate

On 3/15/2018 5:55 PM, Coullie wrote:
> all split my text into lines. my problem is the line count of the multiedit
> Ive attached a png showing the result of the following code
> This indicates to me that my string is correctly split into lines but the line count is still 1

I just tried it here and multiedit works fine if you set the LineSeparator :


For test i used a button press event and did this :

me.Lines.Clear;
me.Lines.LineSeparator := #10;
me.Text := 'a' + #10 + 'b' + #10 + 'c' + #10 + 'd' + #10 + 'e' + #10 + 'f';
ShowMessage(' Line Count = ' + inttostr(me.Lines.Count));


The message dialog shows "Line Count = 6"

and actual display output looks like this

a
b
c
d
e
f

Raul
Sun, Mar 18 2018 10:08 PMPermanent Link

Coullie

Raul wrote:
<For test i used a button press event and did this :
me.Lines.Clear;
me.Lines.LineSeparator := #10;
me.Text := 'a' + #10 + 'b' + #10 + 'c' + #10 + 'd' + #10 + 'e' + #10 + 'f';
ShowMessage(' Line Count = ' + inttostr(me.Lines.Count));>

Yup that works

I think im getting closer. My server (mormot server) is sending #10.
The string is being received in EWB as \n
I get line separation but my ShowMessage shows 1. with only 1 message
If imake me.Lines.LineSeparator := '\n' it doesnt work

I just have to work out where the translation from #10 to \n is taking place
Sun, Mar 18 2018 11:04 PMPermanent Link

Raul

Team Elevate Team Elevate

On 3/18/2018 10:08 PM, Coullie wrote:
> I think im getting closer. My server (mormot server) is sending #10.
> The string is being received in EWB as \n

This looks like mormot issue to me,. I'm no expert but i've really only
seen \n as newline in c/c++.

> I get line separation but my ShowMessage shows 1. with only 1 message
> If imake me.Lines.LineSeparator := '\n' it doesnt work

LineSeparator is declared as string and as per help "Specifies the
character, or characters, to use to separate multiple strings into the
list of strings when assigning a string value to the Text property".

I tried it and yes, there seems to be a bug with the memo.
if i do this
   MultiLineEditOutput.Lines.LineSeparator := '\n';
   MultiLineEditOutput.Text := 'a\nb\nc\nd\ne\nf\ng';

Then it's all shown on a single line but line count itself is reported
correct though.

in your case i'd still suggest tracking down why the \n shows up though
as that likely will simply cause you other problems later as well.

> I just have to work out where the translation from #10 to \n is taking place

You can use browser debug tools to see what the raw data actually looks
like - F12 in most browsers and then network tab or imilar can be used
to see requests/responses with full headers and data.

Raul

Sun, Mar 18 2018 11:36 PMPermanent Link

Coullie

Raul wrote:

<This looks like mormot issue to me,. I'm no expert but i've really only
seen \n as newline in c/c++.>

Thanks Raul and all who advised, found the problem in a parsing function
so as not to break other code using this function I did:

StrReplace(S, '\n', #10, true, false); now I get a line count.
Tue, Mar 20 2018 5:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Coullie,

<< I think im getting closer. My server (mormot server) is sending #10.
The string is being received in EWB as \n
I get line separation but my ShowMessage shows 1. with only 1 message
If imake me.Lines.LineSeparator := '\n' it doesnt work >>

Don't use the JS special strings for line feeds - they can be interpreted differently depending upon the browser engine in use:

https://stackoverflow.com/questions/10887011/javascript-preformatted-text-with-cross-browser-line-breaks

That's why EWB uses specific code points for such characters when dealing with JSON, etc.

Tim Young
Elevate Software
www.elevatesoft.com
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image