Lazarus
Programming => Packages and Libraries => RichMemo => Topic started by: Luca91 on May 25, 2019, 08:06:06 pm
-
Hello everybody,
I'm trying to port an ancient source code from Delphi to Free Pascal.
This app is based on a RichEdit component. Since there isn't a 1:1 implementeation of RichEdit in FP, I'm using RichMemo.
Well, I'm having some problem opening rtf files: when I load the file and call LoadRichText, nothing is displayed (I don't get any error either).
So, I decided to download the official RichMemo examples (located here:https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/richmemo/samples/), and I tried to compile "testsimple". I tried to open the example rtf file, and... nothing is displayed here too!
So, my guess is that there is a bug in the current implementation of RichMemo, at least on Linux.
Furthermore, I've done some tests, and I've found that:
mRichMemo.Text:='Test' // This actually output Test to the RichMemo component
m.RichMemo.Rtf:= 'Test' // Nothing is displayed in the RichMemo component
More details:
My OS: Linux (Arch)
Latest version of Lazarus (2.0.2) and latest version of FPC (3.0.4)
RichMemo package downloaded from the Online Package Manager.
UPDATE:
I tried the same code on Windows 10 and it is working as expected (I can load rtf files, and rtf text is displayed correcly).
So I belive this is a problem of the linux version of RichMemo, and maybe OSX version too.
Is there anything I can do to report this issue and help to fix it?
Thanks a lot!
-
add "richmemortf" unit to the uses section of the project.
add a call to "registerRTFreader" function (defined in richmemortf). The function should be called prior to loading and rtf to any richmemo
-
add "richmemortf" unit to the uses section of the project.
add a call to "registerRTFreader" function (defined in richmemortf). The function should be called prior to loading and rtf to any richmemo
Hello Skalogyz, thank you for your reply.
I tried to add a call to registerRTFreader (right after RegisterRTFLoader in TForm1.FormCreate procedure of the "testsimple" example project), but I get Identifier not found "registerRTFreader".
Of course RichMemoRTF unit was already included in the project.
What I'm doing wrong? Thank you very much for your support.
-
try calling RegisterRTFLoader
-
try calling RegisterRTFLoader
RegisterRTFLoader is already present in the "testsimple" example (it is called in the TForm1.FormCreate).
I'm really afraid that this is a bug. If you are using a Linux distribution, can you test on your side please?
-
what .rtf file are you trying to load?
-
what .rtf file are you trying to load?
The one included in the example called "testsimple" (filename: test5.rtf), but it doesn't work with any rtf files I tried :(
-
here's the screenshot (https://www.dropbox.com/s/bfg2xs53rakb6da/richmemonix.png?raw=1) of what I've.
Are you building Qt version?
-
I tried it myself: "test5.rtf" loaded into "testsimple" does work for gtk2, but for qt the richmemo is empty.
-
that's expect. http://wiki.freepascal.org/RichMemo#Qt
When richmemo was created Qt C-mappings didn't have richedit functionality available.
Thus rich formatting didn't and doesn't work.
I think there were some updates done on Qt(4) and rich edit capabilities are available now. (though I'm not sure).
As well as Qt5 apis should have been ported completely.
-
Thanks for this info. I did not know that.
-
here's the screenshot (https://www.dropbox.com/s/bfg2xs53rakb6da/richmemonix.png?raw=1) of what I've.
Are you building Qt version?
Yes I'm using the Qt version, so that's the problem.
Do you know when Qt5 support will be added? Or, should I switch to gtk2? :-\
-
There's an implementation for Qt5.
But I'm not sure, if it's fully functional (Zeljan Rikalo did Qt5 implementation. See bug report #31426)
-
There's an implementation for Qt5.
But I'm not sure, if it's fully functional (Zeljan Rikalo did Qt5 implementation. See bug report #31426)
Uhmmm, I tried:
LCLWidgetType:=Qt5 -> nothing is displayed after loading the sample rft file
LCLWidgetType:=GTK3 -> Same issue: nothing is displayed after loading the sample rft file
LCLWidgetType:=GTK2 -> When trying to load the sample rft file I get this exception: "EInvalidCast" from gtk2wscustommemo.inc #392
Well, I'm starting to lose my hope :'(
-
Uhmmm, I tried:
LCLWidgetType:=Qt5 -> nothing is displayed after loading the sample rft file
LCLWidgetType:=GTK3 -> Same issue: nothing is displayed after loading the sample rft file
Missing Qt5 is definitely an unfortune.
Gtk3 has not been implemented.
LCLWidgetType:=GTK2 -> When trying to load the sample rft file I get this exception: "EInvalidCast" from gtk2wscustommemo.inc #392
This is a known (and recently fixed issue). However it seems that online package manager has not been updated (try to update)
OR you might want to download the package from here:
https://havefunsoft.com/share/richmemo.zip
-
I've just copied Qt4 implementation part as Qt5 one. Qt5 have more imported classes, so if you need any pls tell so I will add it to libQt5Pas
-
IIRC you've introduced more than I've even asked... the trouble is getting someone out there and have them used.