Forum > RichMemo
Can't stop it word wrapping
(1/1)
geraldholdsworth:
Hi all,
I'm trying to add formatted text to a RichMemo, which goes beyond the width of the control, and it keeps word wrapping. If I extend the width of the control, during run-time, it still wraps at the width it had at design time. I have set WordWrap to False, and ScrollBars to AutoBoth (both at design time and at run time), but this makes no difference. It also happens if I just do Lines.Add(<string>) that is longer than the width available.
I'm using Lazarus v2.2.0 on macOS Catalina. I have no idea what version RichMemo I'm using.
Cheers,
Gerald.
ASBzone:
Can you provide a small running code example that demonstrates what you are experiencing?
geraldholdsworth:
This is what I'm playing with. The RichMemo is Client aligned, and both it and the form are 320px wide in design time.
--- 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, Graphics, Dialogs, ExtCtrls, StdCtrls, RichMemo; type { TForm1 } TForm1 = class(TForm) Button1: TButton; Panel1: TPanel; RichMemo1: TRichMemo; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); procedure AddColorStr(s: string; const col: TColor=clBlack; const NewLine: boolean=true); begin with RichMemo1 do begin if NewLine then begin if RichMemo1.Lines.Count=0 then begin RichMemo1.Lines.Add(''); Lines.Delete(Lines.Count-1); end else AddColorStr(#$0D#$0A,clBlack,False); end; SelStart :=Length(Text); SelText :=s; SelLength:=Length(s); SetRangeColor(SelStart,SelLength,col); SelStart :=Length(Text); SelText :=''; end; end;begin AddColorStr('Black, '); AddColorStr('Green, ' ,$00FF00,false); AddColorStr('Blue, ' ,$FF0000,false); AddColorStr('Red, ' ,$0000FF,false); AddColorStr('Yellow, ' ,$00FFFF,False); AddColorStr('Magenta, ',$FF00FF,false); AddColorStr('Cyan, ' ,$FFFF00,false); AddColorStr('Black, ' ,$000000,false); AddColorStr('Green, ' ,$00FF00,false); AddColorStr('Blue, ' ,$FF0000,false); AddColorStr('Red, ' ,$0000FF,false); AddColorStr('Yellow, ' ,$00FFFF,False); AddColorStr('Magenta, ',$FF00FF,false); AddColorStr('Cyan' ,$FFFF00,false);end; end.
Navigation
[0] Message Index