Rich text viewer lazarus / 31-LCL ---------------------------------------------------------------------- petevick · 2022-02-28 12:39 I want to display a Rich Text File. From an online search I'm lead to believe that either LazRichView or RichMemo will do the trick. I've tried installing RichMemo but it will not install, just a 'cannot install package' message. LazRichView did install, but for the life of me I cannot find any method to load/read an external file. I've found reference to the Delphi version which has a LoadRTF method, but that does not exist for Lazarus. ---------------------------------------------------------------------- AlexTP · 2022-02-28 12:43 Related forum part https://forum.lazarus.freepascal.org/index.php/board,71.0.html ---------------------------------------------------------------------- petevick · 2022-03-01 09:34 Quote from: Alextp on February 28, 2022, 01:43:52 pmRelated forum part https://forum.lazarus.freepascal.org/index.php/board,71.0.html thanks for the reply, but my question related to the LazRichView component and specifically how to load an rtf file into it. ---------------------------------------------------------------------- wp · 2022-03-01 10:44 Quote from: petevick on February 28, 2022, 01:39:31 pmI've tried installing RichMemo but it will not install, just a 'cannot install package' message. Just tried this a few days ago and it worked flawlessly (Laz 2.2.0/FPC 3.2.2, RichMemo from OPM). Maybe I should draw your attention to the fact that RichMemo comes in two packages. The richmemopackage.lpk is the run-time package and cannot be installed. In the subfolder "ide" you find the richmemo_design.lpk designtime package - this is the one which must be installed. When you install the package from OPM (which may be a bit out-dated in comparison with the author's development version on github, though) you need not care about such details. Quote from: petevick on February 28, 2022, 01:39:31 pmLazRichView did install, but for the life of me I cannot find any method to load/read an external file. I've found reference to the Delphi version which has a LoadRTF method, but that does not exist for Lazarus. I seems you are right - I cannot find something like LoadFromFile either. ---------------------------------------------------------------------- balazsszekely · 2022-03-01 10:53 IIRC there is a LoadRichText, or something similar: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  FS: TFileStream;begin  FS := TFileStream.Create(PathToRTf, fmOpenRead or fmShareDenyNone);  try    RichMemo1.LoadRichText(FS);  finally    FS.Free  end; end; ---------------------------------------------------------------------- wp · 2022-03-01 11:06 Yes, for RichMemo, but AFAICS not for RichView. ---------------------------------------------------------------------- petevick · 2022-03-01 11:26 Quote from: wp on March 01, 2022, 11:44:00 amJust tried this a few days ago and it worked flawlessly (Laz 2.2.0/FPC 3.2.2, RichMemo from OPM). Maybe I should draw your attention to the fact that RichMemo comes in two packages. The richmemopackage.lpk is the run-time package and cannot be installed. In the subfolder "ide" you find the richmemo_design.lpk designtime package - this is the one which must be installed. When you install the package from OPM (which may be a bit out-dated in comparison with the author's development version on github, though) you need not care about such details. I was installing it from the OPM, but both lpk packages give a "Cannot compile package" error, and like yourself I'm using Laz 2.2.0 and FPC 3.2.2. ---------------------------------------------------------------------- wp · 2022-03-01 12:38 I should read your signature. I am on Windows, you are on Linux... Tried the same on Linux Mint 10.2 and confirm the issue now. I also tried the version on the author's github - same issue. Since the non-compiling line is inside an {$IFDEF} I looked at the package options and found the define RMLCLTRUNK which is not active. After activating it I could compile both packages on Mint. So, these are the steps how you could make it work for yourself: Open the richmemopackage.lpk in Lazarus ("Package" > "Open Package File")Select "Options" > "Compiler Options" > "Custom Options". Click "Defines..." and check the item RMLCLTRUNK in the checklistbox > "OK"Now you should be able to compile the richmemopackage.lpk.Finally load richmemo_design.lpk and install it (click "Use" > "Install") ---------------------------------------------------------------------- petevick · 2022-03-01 13:06 Quote from: wp on March 01, 2022, 01:38:25 pmFinally load richmemo_design.lpk and install it (click "Use" > "Install")It all went well until this last step, I'm not sure how/where you would 'load' the lpk, but the "Install" option was greyed out. I did manage to install it though via Package>Install/Uninstall packages. That's brilliant work wp, thank you for that ---------------------------------------------------------------------- petevick · 2022-03-01 15:37 and as if by magic, I came across this in the wiki - https://wiki.freepascal.org/File:rmlcltrunkdefine.png ---------------------------------------------------------------------- wp · 2022-03-01 15:38 Quote from: petevick on March 01, 2022, 02:06:48 pmQuote from: wp on March 01, 2022, 01:38:25 pmFinally load richmemo_design.lpk and install it (click "Use" > "Install")It all went well until this last step, I'm not sure how/where you would 'load' the lpk Well, maybe my description was too short here. Go to "Package" > "Open Package file". Navigate to the subfolder "ide" of the folder into which you had unzipped the RichMemo download. Select the file richmemo_design.lpk which must exist in this folder. Although not needed, it may be a good idea to check whether the design-time package compiles: Click "Compile". When ok, click on "Use" > "Install" finally. ---------------------------------------------------------------------- wp · 2022-03-01 15:40 Quote from: petevick on March 01, 2022, 04:37:20 pmand as if by magic, I came across this in the wiki - https://wiki.freepascal.org/File:rmlcltrunkdefine.png And the associated text is here: https://wiki.freepascal.org/RichMemo#2.1.0_.28trunk.2Flater.29