Forum > RichMemo

Numbered list in RichMemo

(1/4) > >>

paxnet_be:
Hi,
I'm trying to set a numbered list in RichMemo, but I'm stuck with the numbering:
after creating successfully the first list item, the number stays on 1 and does not increase.
I don't know how to solve it. Can someone help me?
Thanks in advance.

rvk:
I'm not sure what you are trying to accomplish with this line:

--- 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";}};} ---RichMemo1.Text := RichMemo1.Text + ListItem;
But that line strips the Text from ALL formatting.
RichMemo1.Text is a text representation of your RTF without formatting.
So when assigning that back to RichMemo1.Text you'll loose all formatting.

If you want to add a line to the current listitem you could use

--- 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";}};} ---RichMemo1.Lines.Add(ListItem);
If you want to create a complete new listitem you can do:

--- 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";}};} ---var  ListItem: String;begin  ListItem := 'New bullet';  RichMemo1.SelLength := 0;  RichMemo1.SelText := #13 + ListItem;  RichMemo1.SelLength := 0;

Thaddy:
You can use TrichMemo.SetRangeParaNumbering. pnBullet is the bullet style and pnNumber is the numbered style.

rvk:

--- Quote from: Thaddy on July 31, 2023, 06:27:23 pm ---You can use TrichMemo.SetRangeParaNumbering. pnBullet is the bullet style and pnNumber is the numbered style.

--- End quote ---
He wants a numberstyle, as stated in the question !!
That works... but when adding text (as done in the supplied code) the number doesn't increase.

Thaddy:
It works, provided the paragraph is defined.

Navigation

[0] Message Index

[#] Next page

Go to full version