Using RichViewEdit version 17.4, Delphi 10 Seattle
Some of our customers have reported that it is difficult to resize my application window when RichViewEdit controls contain fairly large documents (between 1 and 2 MB of text). Multiple documents are loaded on tabs in a page control. The window is slow to respond to the sizing.
I was wondering about handling WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE in my code to manually reformat richview controls after the window sizing has completed. I haven't been able to get it to work, I think it may be because TCustomRichView is invalidating when it receives WM_Size messages. If I set the RVData flag rvflPrinting in my EnterSizeMove message handler, it works perfectly, the procedure WMSize in TCustomRichView checks this flag before calling FullInvalidate. So setting the flag allows me to resize the window normally, then reformat in my ExitSizeMove message handler.
Is there some other way to handle this?
Resize window and large document
Re: Resize window and large document
jimbr32,
Curious if you ever solved this and if so, how? If setting the RVData flag rvflPrinting worked, do you have an example of how you did that?
I've run into this before with formatting components and I've basically locked the component while resizing and then unlocked it after. So far I have not found a good way to do this with my regular rve.
Thanks
Stan
Curious if you ever solved this and if so, how? If setting the RVData flag rvflPrinting worked, do you have an example of how you did that?
I've run into this before with formatting components and I've basically locked the component while resizing and then unlocked it after. So far I have not found a good way to do this with my regular rve.
Thanks
Stan
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Resize window and large document
You can try to include/exclude rvstSkipformatting in RichViewEdit.RVData.State.
Re: Resize window and large document
Hi Sergey,Sergey Tkachenko wrote: ↑Mon Sep 11, 2023 9:04 am You can try to include/exclude rvstSkipformatting in RichViewEdit.RVData.State.
Yes, that seems to work. Here's what I did:
Code: Select all
private
FSizing: boolean;
...
procedure TForm1.WndProc(var Message: TMessage);
const
ResizeLock = 1000;
begin
if Message.Msg = WM_SYSCOMMAND then
begin
//http://www.delphigroups.info/2/13/524188.html
if (Message.WParam and $FFF0) = SC_SIZE then
if rve.LineCount > ResizeLock then
begin
FSizing := true;
LockWindowUpdate(MainPanel.Handle);
rve.RVData.State := rve.RVData.State + [rvstSkipformatting];
end;
end;
if Message.Msg = WM_EXITSIZEMOVE then
begin
if FSizing then
begin
FSizing := false;
Screen.Cursor := crAppStart;
rve.RVData.State := rve.RVData.State - [rvstSkipformatting];
rve.ReformatAll;
LockWindowUpdate(0);
Screen.Cursor := crDefault;
end;
end;
This works. I don't load huge files that often but when I do, the delay with "live formatting" can be an issue.
Thanks Sergey, as usual a great help!
Stan