1

In a 32-bit VCL Application in Windows 10 in Delphi 11 Alexandria, I use the new TRichEdit control. I have the following code to INDENT the current paragraph:

procedure TformMain.menuitemIndentDecreaseClick(Sender: TObject);
begin
  richeditNotesEditor.Paragraph.FirstIndent := richeditNotesEditor.Paragraph.FirstIndent - 10;
  menuitemIndentDecrease.Enabled := richeditNotesEditor.Paragraph.FirstIndent > 9;
end;

procedure TformMain.menuitemIndentIncreaseClick(Sender: TObject);
begin
  richeditNotesEditor.Paragraph.FirstIndent := richeditNotesEditor.Paragraph.FirstIndent + 10;
  menuitemIndentDecrease.Enabled := True;
end;

It works well:

enter image description here

However, each indented paragraph uses the same bullet. How can I automatically have different bullets according to how much the paragraph is indented?

user1580348
  • 5,721
  • 4
  • 43
  • 105
  • 1
    To 90%, this isn't a Delphi question but a Win32 question, since the [`TRichEdit`](https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.ComCtrls.TRichEdit) is merely a fairly thin wrapper for the Win32 [RICHEDIT](https://learn.microsoft.com/en-us/windows/win32/controls/rich-edit-controls) control. And that question has been [asked before](https://stackoverflow.com/questions/15367975/rtf-bullet-list-example). So to 90%, this Q is a duplicate. Basically, it seems like the bullet is stored (rather non-semantically) as a character in the RTF. – Andreas Rejbrand Jan 17 '22 at 09:11
  • Bonus hint: Try Shift+Ctrl+L in a TRichEdit. – Andreas Rejbrand Jan 17 '22 at 09:11
  • (But the old Q is more about the RTF code than the Win32 control's API.) – Andreas Rejbrand Jan 17 '22 at 09:25
  • @AndreasRejbrand Shift+Ctrl+L only selects the current line. What is it supposed to do? – user1580348 Jan 17 '22 at 09:30
  • @AndreasRejbrand I know that `TRichEdit` is a wrapper of the Windows control. Nevertheless, I am curious about how to achieve what I want with Delphi code. – user1580348 Jan 17 '22 at 09:33
  • Really? Shift+Ctrl+L is supposed to cycle through all bullet and number styles. (There is only a single bullet style but many numbering styles.) – Andreas Rejbrand Jan 17 '22 at 09:33
  • Yes, but there is no TRichEdit-specific solution for this, so you'll need to use the Win32 API. And so the solution will be exactly the same in C, C++, Delphi, etc. – Andreas Rejbrand Jan 17 '22 at 09:34
  • Still, +1 for an interesting question. As hinted above, I cannot find any other Q which is about changing bullet style programmatically. – Andreas Rejbrand Jan 17 '22 at 09:47
  • Even in WORDPAD editing an RTF file, Shift+Ctrl+L only selects the current line. – user1580348 Jan 17 '22 at 09:56
  • Maybe this depends on your locale (Austria). In English and Swedish, it is Shift+Ctrl+L. https://i.stack.imgur.com/JV67s.gif – Andreas Rejbrand Jan 17 '22 at 10:00
  • I changed the bullet style of a single paragraph in WordPad: https://i.imgur.com/f4gpmYm.png and then loaded the RTF saved from Wordpad in Delphi's `TRichEdit`: The changed bullet-style was preserved. So this is proof that WordPad uses the same new RichEdit control as Delphi 11 Alexandria. So, what is possible in WordPad (changing bullet-style) should also be possible in Delphi. – user1580348 Jan 17 '22 at 10:06
  • Of course, it's the same Rich Edit. (But beware that this control exists in several different versions.) – Andreas Rejbrand Jan 17 '22 at 10:13
  • I've found the culprit: It was a system-wide macro. Now I've deactivated that system-wide macro, and now Shift+Ctrl+L does work as intended. Thank you for that hint! Now I only need to access any of these bullet styles explicitly from my own controls, like in WordPad. – user1580348 Jan 17 '22 at 10:21
  • 1
    I'm a bit busy right now, but maybe I'll get some time to investigate this (very interesting question) later this week. – Andreas Rejbrand Jan 18 '22 at 08:22

0 Answers0