Break line in character

1

I have an application where a TLabel receives a line of a TMemo ,

But the form that I'm displaying has to be small, and the information is large.

My idea is that when it reaches a certain number of characters the sentence would continue on the bottom line.

So I'm using the function below to count the number of characters in the first line of TMemo

tamMemoCaption:=inttostr(Length(form1.memo5.Lines.text));

What I need is that when the size reaches 24 for example of the text of TMemo , from there it will break to the bottom line or a new TLabel receive the information

I tried to use the WordWrap option, but no results.

Any guidance?

    
asked by anonymous 23.12.2015 / 16:19

1 answer

2

Imagine and try to use the same internal function that is already using Length .

procedure CopiaApenasPartesString;
var
  vRestante,
  vTextoAuxiliar : String;  
begin
  vTextoAuxiliar := O texto que você esta inserindo no TMemo;

  if (Length(vTextoAuxiliar) > 24) then
  begin
    Memo.Lines.Add(Copy(vTextoAuxiliar,1,24); //Copia os Primeiros 24 Caracteres
    vRestante := Copy(vTextoAuxiliar,1,Length(vTextoAuxiliar));
    if (Length(vRestante) > 24) then
      Memo.Lines.Add(Copy(vRestante,1,24); //Copia mais 24 Caracteres
  end;
end;

In this way, every 24 characters the text is entered in TMemo .

Please note that I have not used any repeat structures, you can mount Array according to the need or size of the Text!

However, using TMemo itself, setting a Width to it that is 24 characters long and with the WordWrap property enabled should already work without any helper code!

    
23.12.2015 / 17:33