Hi!
I want to input sentences as Label Caption on run time.
The idea is to break the sentences in several lines with LineEnding.
This is what I have, but obviously not what it should be.
I want the lines to be of a certain length instead of 10 words per line.
Also the maximum C variable for looping should be not higher than the number of words.
ReadString := ‘Welcome sir, I hope you had a pleasant journey. I will guide you to the base from here but feel free to ask me to guide you around the island also.’;
ReadString:= MidStr(ReadString, 0, Length(ReadString));
for C := 1 to 500 do
begin
EndPos := PosEx(’ ', ReadString, StartPos);
Word[C] := MidStr(ReadString, StartPos, EndPos - StartPos);
StartPos := EndPos + 1;
end;
TalkTextLabel.Caption :=
Word[1] + Word[2] + Word[3] + Word[4] + Word[5] + Word[6] + Word[7] + Word[8] + Word[9] + Word[10] + LineEnding +
Word[11] + Word[12] + Word[13] + Word[14] + Word[15] + Word[16] + Word[17] + Word[18] + Word[19] + Word[20] + LineEnding +
Word[21] + Word[22] + Word[23] + Word[24] + Word[25] + Word[26] + Word[27] + Word[28] + Word[29] + Word[30] + LineEnding +
Word[31] + Word[32] + Word[33] + Word[34] + Word[35] + Word[36] + Word[37] + Word[38] + Word[39] + Word[40] + LineEnding +
Word[41] + Word[42] + Word[43] + Word[44] + Word[45] + Word[46] + Word[47] + Word[48] + Word[49] + Word[50] + LineEnding;