Recent

Author Topic: Length of text in a RichMemo  (Read 4246 times)

Curt Carpenter

  • Sr. Member
  • ****
  • Posts: 396
Re: Length of text in a RichMemo
« Reply #15 on: January 23, 2023, 03:50:56 am »
If you compare the full text of a richmemo in Windows to one in linux, you will find that they are completely different.  As far as I can tell, my Ubuntu linux richmemo contains no #13s or #10s at all while the same text in Windows contains both.  That can cause headaches if you're compiling code for both platforms. 

But that said, once you get it sorted our, RichMemo is a great contribution to lazarus.   

rvk

  • Hero Member
  • *****
  • Posts: 6111
Re: Length of text in a RichMemo
« Reply #16 on: January 23, 2023, 10:18:25 am »
If you compare the full text of a richmemo in Windows to one in linux, you will find that they are completely different.  As far as I can tell, my Ubuntu linux richmemo contains no #13s or #10s at all while the same text in Windows contains both.  That can cause headaches if you're compiling code for both platforms.
Why would you want #13 and #10 in RTF text. It shouldn't be there to begin with.
(BTW the RTF-source itself could be different depending on platform because on Windows the Windows dll is used and on Linux not.)

How are you retrieving that text?
If you are talking about converting RTF to a text string, then it is important how you are doing that (or what function you are using).

Curt Carpenter

  • Sr. Member
  • ****
  • Posts: 396
Re: Length of text in a RichMemo
« Reply #17 on: January 23, 2023, 06:22:03 pm »
Not a question of "wanting" them  rvk, but of coping with them when they're there or not.

I was recently tasked with converting a legacy Delphi3 program to FPC to run on both Windows and Linux, converting old "memo" data to rich text.  The program accessed a 20 year old (and still growing) data base that stored all of its data as ANSI strings.  This meant that a full page of rich text-formated text had to be stored in a string list.

To get the data, I used this:

Code: Pascal  [Select][+][-]
  1. RichMemo.SaveRichText(MStream);
  2.      if MStream.Size > 0 then
  3.       begin
  4.        setLength(S,MStream.Size);
  5.        move(MStream.Memory^,S[1],MStream.Size);      
  6.  

Where MStream is a memory stream.  Run with Linux, the resulting string has no CRs or LFs, while when run with Windows, it does (or so I recall -- might be some lost memories on my part about the full details).

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: Length of text in a RichMemo
« Reply #18 on: January 31, 2023, 06:05:40 pm »
What happens, if you write
Code: Pascal  [Select][+][-]
  1. RichMemo1.Lines.Add(Code.Text);

?

 

TinyPortal © 2005-2018