David Schwartz 426 Posted August 23, 2020 I'd like to find a simple RTF editor, like Notepad, but that lets you select fg and bg colors, fonts, styles, and so on. Not HTML. Short of that, I'd like to find a library that I can use to build it. (I have TRichView myself, but it's for something I'm noodling with at work, and they won't pay for anything for that purpose.) Any ideas? Share this post Link to post
Anders Melander 1783 Posted August 23, 2020 Did you mean WordPad and not Notepad? Notepad is for plain text and uses the same Windows control as the standard TMemo control. WordPad is for RTF and uses the same Windows control as the standard TRichEdit control. Share this post Link to post
FPiette 383 Posted August 23, 2020 There are plenty of Delphi sample program using TRichEdit which is an RTF editor. Share this post Link to post
Edwin Yip 154 Posted August 24, 2020 why not just use TRichEdit? On the other hand, TJvRichEdit of the JVCL package is an enhanced rich editor. Share this post Link to post
aehimself 396 Posted August 25, 2020 I'd choose SynEdit. Supports syntax highlighting, code folding and even completion. I made my own SQL syntax highlighter based on a TRichEdit component but it seriously started to lag when the script was around 3000 lines (full parsing and recoloring needed 300 ms, which is way too noticeable when it runs after each keypress...). Although I could have optimized the logic (move parsing to a BG thread, only recolor when a closer was entered, only parse changed lines, etc) I just pulled SynEdit from GitHub and I'm very happy with it ever since. I don't like having a full package installed in my IDE for one project only, but seeing how smooth and fluid that implementation is compared to mine... well, it will stay forever, I suppose 🙂 Share this post Link to post
Edwin Yip 154 Posted August 25, 2020 But SynEdit doesn't even perform line breaking correctly... Quite a showstopper... Share this post Link to post
David Schwartz 426 Posted August 26, 2020 I searched in Google for an example of something built with a TRichEdit in Delphi, but didn't have much luck. I know I've seen several over the years, but now when I want one, I can't seem to find one. I found a very cursory one from a guy in Italy, and all of the comments are in Italian. But even though it has a Load and Save function, it doesn't save or load RTF data. I did, however, figure that part out. 🙂 I do not need a full-featured word processor. I basically want to cannibalize parts of it for use in another application -- mostly font features so I can highlight things, change fonts and/or sizes, stuff like that. Share this post Link to post
Rollo62 536 Posted August 26, 2020 (edited) Right, the last reasonable project I have seen here. https://www.delphipraxis.net/203346-texte-richedit-suchen-und-markieren.html#post1457012 There is not much for RichText, thats why I try to move to HtmlEditor in my projects. Edited August 26, 2020 by Rollo62 Share this post Link to post
Anders Melander 1783 Posted August 26, 2020 3 hours ago, David Schwartz said: I searched in Google for an example of something built with a TRichEdit in Delphi, but didn't have much luck. If you need an example of what TRichEdit can do just run Wordpad. If you need examples of how to do it read the help or Google it. There are hundreds of examples. If you have an older version of Delphi installed there's even a richedit example project. I don't see the problem. Share this post Link to post
Fr0sT.Brutal 900 Posted August 26, 2020 For such basic features as font/color styling TRichEdit is quite enough. Changing style of text fragments is several lines of code Share this post Link to post
FPiette 383 Posted August 26, 2020 3 hours ago, David Schwartz said: I searched in Google for an example of something built with a TRichEdit in Delphi, but didn't have much luck. Try this: http://svn.code.sf.net/p/radstudiodemos/code/branches/RadStudio_XE6/Object Pascal/VCL/RichEdit/ For unknown reason, Embarcadero removed that demo for later Delphi versions. 1 Share this post Link to post
Lars Fosdal 1792 Posted August 26, 2020 I see that the Rich Edit control has "moved" - not sure if the old wrapper supports 4.1?https://docs.microsoft.com/en-us/windows/win32/controls/about-rich-edit-controls VERSIONS OF RICH EDIT Rich Edit version DLL Window Class 1.0 Riched32.dll RICHEDIT_CLASS 2.0 Riched20.dll RICHEDIT_CLASS 3.0 Riched20.dll RICHEDIT_CLASS 4.1 Msftedit.dll MSFTEDIT_CLASS Share this post Link to post
Anders Melander 1783 Posted August 26, 2020 34 minutes ago, Lars Fosdal said: I see that the Rich Edit control has "moved" - not sure if the old wrapper supports 4.1? I can't see how that is relevant. Just because new control versions are added doesn't mean the old ones stop working. TRichEdit is a wrapper around the RICHEDIT20W window class (i.e. RICHED20.DLL). Override CreateParams to use another version if that's important. Share this post Link to post
Lars Fosdal 1792 Posted August 26, 2020 Well, the old RichEdit demo was removed. Who knows. Share this post Link to post
Anders Melander 1783 Posted August 26, 2020 1 hour ago, Lars Fosdal said: Who knows. Who knows what? Share this post Link to post
Lars Fosdal 1792 Posted August 26, 2020 3 minutes ago, Anders Melander said: Who knows what? Why... Who knows why. 1 Share this post Link to post