Forum > RichMemo

Numbered list in RichMemo

<< < (4/4)

paxnet_be:
May be it's useful to know, that on my Linux Lazarus works with GTK2.

rvk:
I've just tried it in Ubuntu and auto numbering when typing just doesn't work.
I guess this is a limitation of the widget in the OS.

What you can do is first just add all the lines you want (with #13 / new lines separated).
Then apply the numbering to your desired text.

Something like this:

--- 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";}};} ---procedure TForm1.Button2Click(Sender: TObject);var  pn: TParaNumbering;begin  RichMemo1.Clear;  RichMemo1.Lines.Add('First item');  RichMemo1.Lines.Add('Second item');  RichMemo1.Lines.Add('Third item');   pn.Style := pnNumber;  pn.Indent := 14;  pn.NumberStart := 1;  pn.SepChar := SepDot;  RichMemo1.SetParaNumbering(0, Length(RichMemo1.Lines.Text) - 1, pn);  // -1 so the last line doesn't get a number end;
BTW. There is a unit RichMemoHelpers which has some extra helper functions.
When adding the RichMemoHelpers to your uses you can directly access SelAttributes without needing to fiddle with a separate record.


--- 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";}};} ---uses RichMemoHelpers;//...  RichMemo1.SelAttributes.Color:= clBlue;  RichMemo1.SelAttributes.Style := RichMemo1.SelAttributes.Style + [fsBold, fsItalic];
Unfortunately there is no such helper for the ParaNumbering.
But it does for TParaMetric in Paragraph.

paxnet_be:
This solution works for me !  :D

I will use this further in my application.

Thank you very much, rvk, for your support.

Navigation

[0] Message Index

[*] Previous page

Go to full version