Forum > LCL
Showmessage MessageBox MessageDlg long string
k1attila1:
Hello
Showmessage, MessageBox, MessageDlg wrap/break the line if string is long (eg 100 char)
Does anybody know any solution or it is OS problem (Win10) ?
thank you Attila
Handoko:
Tested ShowMessage's wrapping behavior on Lazarus 1.6.4 FPC 3.0.2 on my Ubuntu Mate 16.10 computer. And this is the test result:
- The message will be wrapped on char 32 if the line is too long.
- The message won't be wrapped nor truncated even it exceeds my screen width, if the string doesn't contain space (chr 32).
This is the code I used:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { private declarations } public { public declarations } end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);var i: Integer; S: string;begin S := ''; for i := 1 to 20 do S := S + IntToStr(i)+'-123456 '; // has chr 32 ShowMessage(S); S := ''; for i := 1 to 20 do S := S + IntToStr(i)+'-123456x'; // no chr 32 ShowMessage(S); end; end.
ASerge:
--- Quote from: k1attila1 on April 20, 2017, 07:08:45 pm ---Does anybody know any solution or it is OS problem (Win10) ?
--- End quote ---
What is solution?
My test. Windows 7 x64.
Dialogs.ShowMessage, Application.MessageBox, Dialogs.MessageDlg wrap after 59 chars if text contain space, or show 56 chars with '...' on single line without wrap.
Windows.MessageBox always wrap text. After 73 chars or early, if text contain space.
Handoko:
So the ShowMessage's behavior is OS depended. My test never got a '...' even the string's length is 491 (for i := 1 to 50).
k1attila1:
Thank You
So it is OS problem and not Lazarus.
Thank You again Attila
Navigation
[0] Message Index
[#] Next page