Lazarus

Programming => Packages and Libraries => RichMemo => Topic started by: Luca91 on May 25, 2019, 08:06:06 pm

Title: RichMemo LoadRichText not working on Linux
Post 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!
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 25, 2019, 09:44:05 pm
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
Title: Re: RichMemo LoadRichText not working on Linux
Post by: Luca91 on May 26, 2019, 03:35:22 pm
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.
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 26, 2019, 11:11:48 pm
try calling RegisterRTFLoader
Title: Re: RichMemo LoadRichText not working on Linux
Post by: Luca91 on May 27, 2019, 10:23:35 am
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?
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 27, 2019, 06:20:58 pm
what .rtf file are you trying to load?
Title: Re: RichMemo LoadRichText not working on Linux
Post by: Luca91 on May 27, 2019, 08:58:55 pm
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  :(
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 27, 2019, 09:12:18 pm
here's the screenshot (https://www.dropbox.com/s/bfg2xs53rakb6da/richmemonix.png?raw=1) of what I've.

Are you building Qt version?
Title: Re: RichMemo LoadRichText not working on Linux
Post by: wp on May 27, 2019, 10:08:05 pm
I tried it myself: "test5.rtf" loaded into "testsimple" does work for gtk2, but for qt the richmemo is empty.
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 27, 2019, 10:30:32 pm
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.
Title: Re: RichMemo LoadRichText not working on Linux
Post by: wp on May 27, 2019, 11:19:19 pm
Thanks for this info. I did not know that.
Title: Re: RichMemo LoadRichText not working on Linux
Post by: Luca91 on May 28, 2019, 11:14:56 am
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?  :-\
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 29, 2019, 05:20:15 pm
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)
Title: Re: RichMemo LoadRichText not working on Linux
Post by: Luca91 on May 30, 2019, 02:57:22 pm
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  :'(
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 30, 2019, 03:32:35 pm
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
Title: Re: RichMemo LoadRichText not working on Linux
Post by: zeljko on May 30, 2019, 06:05:32 pm
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
Title: Re: RichMemo LoadRichText not working on Linux
Post by: skalogryz on May 30, 2019, 06:07:06 pm
IIRC you've introduced more than I've even asked... the trouble is getting someone out there and have them used.
TinyPortal © 2005-2018