Recent

Author Topic: RichMemo LoadRichText not working on Linux  (Read 5368 times)

Luca91

  • Newbie
  • Posts: 6
RichMemo LoadRichText not working on Linux
« 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!
« Last Edit: May 25, 2019, 08:30:38 pm by Luca91 »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #1 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

Luca91

  • Newbie
  • Posts: 6
Re: RichMemo LoadRichText not working on Linux
« Reply #2 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.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #3 on: May 26, 2019, 11:11:48 pm »
try calling RegisterRTFLoader

Luca91

  • Newbie
  • Posts: 6
Re: RichMemo LoadRichText not working on Linux
« Reply #4 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?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #5 on: May 27, 2019, 06:20:58 pm »
what .rtf file are you trying to load?

Luca91

  • Newbie
  • Posts: 6
Re: RichMemo LoadRichText not working on Linux
« Reply #6 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  :(

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #7 on: May 27, 2019, 09:12:18 pm »
here's the screenshot of what I've.

Are you building Qt version?

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: RichMemo LoadRichText not working on Linux
« Reply #8 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.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #9 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.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: RichMemo LoadRichText not working on Linux
« Reply #10 on: May 27, 2019, 11:19:19 pm »
Thanks for this info. I did not know that.

Luca91

  • Newbie
  • Posts: 6
Re: RichMemo LoadRichText not working on Linux
« Reply #11 on: May 28, 2019, 11:14:56 am »
here's the screenshot 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?  :-\

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #12 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)

Luca91

  • Newbie
  • Posts: 6
Re: RichMemo LoadRichText not working on Linux
« Reply #13 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  :'(

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: RichMemo LoadRichText not working on Linux
« Reply #14 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

 

TinyPortal © 2005-2018