Hello everyone, Keep up the good work, is there any way to control line break (CR LF or LF) on jEditText ?
I need to display plain text only.
I use LAMW 0.8.6.3 (lazarus 2.0.12) on a Linux (Ubuntu M
ate 22.04)
The following code works but the contents of .ini file are displayed as wrapping text not with the correct format (Text line breaks are ignored)
when i open it on an editor its contents are ok.
procedure TSettingsFrm.DialogYN1ClickYN(Sender: TObject; YN: TClickYN);
var
FileBase:string;
begin
if (YN = ClickYes) then
begin
FileBase:=GetInternalAppStoragePath;
EditText1.LoadFromFile(FileBase + PathDelim + 'settings.ini');
end
else
ShowMessage('Canceled');
end;
Thanks for any response.
[Edit]
Solved by reading the file as text file and add the linebreaks manually, it seems that the jEditText.LoadFromFile() method strips control characters and is not possible to handle it as jEditText.Text.
procedure TSettingsFrm.SettingsFrmShow(Sender: TObject);
var
AssetsBase:string;
infile: TextFile;
ch: Char;
begin
AssetsBase:=GetInternalAppStoragePath;
AssignFile(infile, AssetsBase + PathDelim + 'settings.ini');
Reset(infile);
EditText1.Text:='';
While not Eof(infile) do
begin
Read(infile, ch);
if (ch = #10) then EditText1.AppendLn('')
else
EditText1.Append(ch);
end;
CloseFile(infile);
end;