Which EVENT triggered after loading RTF file?

General TRichView support forum. Please post your questions here
Post Reply
fatih
Posts: 5
Joined: Sun May 11, 2025 3:22 pm

Which EVENT triggered after loading RTF file?

Post by fatih »

I load large RTF file using TRichViewEdit. I want to display loading cursor when RTF file is loading.

However this code immediately changes the cursor to crDefault (before loading the RTF completely).

Code: Select all

Screen.Cursor:=crAppStart;
Application.ProcessMessages;
RichViewEdit1.ClearAll;
RichViewEdit1.LoadRTF('C:\document.rtf');
RichViewEdit1.Format;
Screen.Cursor:=crDefault;
Which event is triggered after loading RTF file? (Apparently OnLoadDocument doesn't work for my use case)
Sergey Tkachenko
Site Admin
Posts: 17836
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Which EVENT triggered after loading RTF file?

Post by Sergey Tkachenko »

No event occurs after loading RTF file.
OnLoadDocument occurs when loading a document from DB via LiveBindings.
Even if this event existed, nothing would be changed.

Maybe it will work if you remove Application.ProcessMessages?
fatih
Posts: 5
Joined: Sun May 11, 2025 3:22 pm

Re: Which EVENT triggered after loading RTF file?

Post by fatih »

Removing Application.ProcessMessages has no effect. I think TRichViewEdit loads documents asynchronously. OnLoadingFinished event would be fine, but it is not very important.

TRichViewEdit becomes sluggish when it has some large images. Is there anything we can do about it? (I am using VCL)
Sergey Tkachenko
Site Admin
Posts: 17836
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Which EVENT triggered after loading RTF file?

Post by Sergey Tkachenko »

1. Sorry, but I cannot reproduce this problem with the mouse cursor.
I checked the demo in TRichView\Demos\Editors\Editor 1\

It has Screen.Cursor := crHourglass before loading, and Screen.Cursor := crDefault; after.
(the call of RichViewEdit1.Format is after restoring the cursor; it's not good, you correctly restore it a formatting).
I can see the hourglass cursor while loading a large RTF file.
Neither RTF loading not formatting is asynchronous, so the event will not be useful.

Maybe you expect that a waiting cursor is shown everywhere on the screen?
Screen.Cursor does not work in this way: the waiting cursor is shown when the mouse is above the window of your application.

2. Some delay may occur when the image is shown for the first time.
It's because:
- some graphic classes (like TJpegImage) are initialized on the first displaying;
- if the image is scaled, TRichView creates a thumbnail for it.
After the first displaying, the image must be drawn much faster.
Post Reply