🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #595

Re: converting string stored in a file into Rich Text Edit

#595
From: Cybercat
Date: Sat, 07 Mar 1998 00:00
46 lines
2383 bytes
On Fri, 06 Mar 1998 08:38:41 +0100, pierre guinnard
<guinnard@iprolink.ch> wrote:

>Hello everybody,
>
>I got a little problem while updating a software. The problem is :
>
>In the original application, the data are stored in such a record :
>              My_Data    =  Record
>                                     LAW_FPos   :  String
>[03];            LAW_NrFill  :  Integer;
>                                     LAW_Text    :  Array [01..13] of
>String [255];
>                                     End;
>And I should display those data in a box built with "TRichEdit". Those
>string are concatenated together, with appropriate "Carriage Return" and
>"Line Feed" characters inserted.
>
>The only result I got is the display of the first 255 characters, and I
>can't get the following characters.

I suspect that when you concatenate the various strings, you assign
the result to a String[255]. I do not know how you've set the compiler
directives, so I'd propose you use S: AnsiString (most of us simply
use String without a maximum length specifier, which serves as a "long
sting", that is one that might be much longer than 255 characters.

procedure TForm1.AddToRichEdit(TheData: My_Data);
var S,T: AnsiString;
begin
  S := '';
  for I := 1 to 15 do
    with TheData do
    begin
      case I of
        1: T := LAW_FPos;
        2: T := IntToStr(LAW_NrFill);
        else T := LAW_Text[I-2]
      end;
      S := Concat(S,T,^M,^J)
    end;
  RichEdit1.Text := S
end;

Should do the trick.
Technical Details
Message-ID: <3501a463.9105780@news.mia.bellsouth.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34FFA801.AA511B4F@iprolink.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10baee,e7eb6ea95fc0ed8b
X-Google-Attributes: gid10baee,public
X-Google-Thread: 1043cf,e7eb6ea95fc0ed8b
X-Google-Attributes: gid1043cf,public
X-Google-Thread: 108b0b,e7eb6ea95fc0ed8b
X-Google-Attributes: gid108b0b,public
X-Google-Thread: 1027ab,e7eb6ea95fc0ed8b
X-Google-Attributes: gid1027ab,public
From: MauriceV@bellsouth.net (Cybercat)
Subject: Re: converting string stored in a file into Rich Text Edit
Date: 1998/03/07
Message-ID: <3501a463.9105780@news.mia.bellsouth.net>
X-Deja-AN: 331769266
References: <34FFA801.AA511B4F@iprolink.ch>
Organization: Fundi Software
NNTP-Posting-Date: Sat, 07 Mar 1998 19:57:14 EST
Reply-To: MauriceV@bellsouth.net
Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.objectpascal,cern.delphi,cern.delphi.general