Board index » delphi » Using "SetLength" procedure in a TMemo

Using "SetLength" procedure in a TMemo

Quote
Red Hat wrote in message <3c20518...@news.iprimus.com.au>...
>I'm a novice using Delphi Pro 5 and I have the following dilemma:

>var I: Integer; //and ContentsEdit is of the type TMemo.
>Begin
>   For I := 0 to 9999 DO BEGIN
>      ContentsEdit.Lines[I] := 'Do da do da';
>      END;
>END;

>Using this, I should expect to find in the Memo, 10000 lines of "Do da do
>da", but all I find is one line. The first line in the Memo Box
>(ContentsEdit). I consulted the manual and the help files in delphi
itself,
>it uses a procedure called "setLength", I thought this may have had
>something to do with it, but I couldn't get it to work.  Can anyone help
me,
>because I need this for a notepad application I'm making.

What do you want?

If you want to have ten thousand lines of text, produce them
in a string variable and set the Text property to it.

I don't see how a notepad application requires any of this.
It might help if you cleared that up for me.

Groetjes,
Maarten Wiltink

 

Re:Using "SetLength" procedure in a TMemo


Try this, it will do the trick.

var I: Integer; //and ContentsEdit is of the type TMemo.
     Begin
         For I := 0 to 9999 DO
              BEGIN
                     Contents.lines.add('Do da do da');
              END;
      END;

Jon

Quote
"Red Hat" <matt...@iprimus.com.au> wrote in message

news:3c20518a_1@news.iprimus.com.au...
Quote
> I'm a novice using Delphi Pro 5 and I have the following dilemma:

> var I: Integer; //and ContentsEdit is of the type TMemo.
> Begin
>    For I := 0 to 9999 DO BEGIN
>       ContentsEdit.Lines[I] := 'Do da do da';
>       END;
> END;

> Using this, I should expect to find in the Memo, 10000 lines of "Do da do
> da", but all I find is one line. The first line in the Memo Box
> (ContentsEdit). I consulted the manual and the help files in delphi
itself,
> it uses a procedure called "setLength", I thought this may have had
> something to do with it, but I couldn't get it to work.  Can anyone help
me,
> because I need this for a notepad application I'm making.

> Thanks
> Matt 16 - Brisbane, Australia

Other Threads