time passed until first typed letter appeared in memo.

General TRichView support forum. Please post your questions here
Post Reply
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

time passed until first typed letter appeared in memo.

Post by j&b »

I have copied more and more pictures over time into a TRichView-Memo. Some day I noticed that more and more time passed until first typed letter appeared in memo.
Following typed letter immediately appeared. Cause are the many pictures.

1. Can you solve this problem so that letter 'immediately' appears (as usual)
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: time passed until first typed letter appeared in memo.

Post by j&b »

I've forgotten:

2. How can I know how many bytes occupy a memo (with pictures
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: time passed until first typed letter appeared in memo.

Post by Sergey Tkachenko »

How can I reproduce this problem?
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: time passed until first typed letter appeared in memo.

Post by j&b »

Hello Sergey,

you copy many pictures into a TRichView memo. How many do you have to try.
Then you change the record and return to the memo (with the many pictures) and write a word in the memo. Although you have already pressed some letters, the first letter of the word appears only after a short time.

Through my solution Cursor appears after a short time. Then you can write a word without the described effect.



My solution:

I add 4 lines at the end of memo.Enter.
They cause that the pressed letter appears immediately as soon as the cursor appears in memo.

I would like to use these 2 lines only if the memo exceeds a certain size ('memo.size')


procedure TForm1.memoEnter(Sender: TObject);
begin
...
if memo.size>xyz then begin
RVSetLinearCaretPos(memo,0);
memo.InsertText('',false);

end;
end;

Does someone know a better solution?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: time passed until first typed letter appeared in memo.

Post by Sergey Tkachenko »

For testing, try to increase side of image cache.

Add in DPR file, before creating any form:

uses RVGrCache;

RichViewMaxPictureCount := 10000; // set value greater than the count of pictures in your document
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: time passed until first typed letter appeared in memo.

Post by j&b »

Your hint wasn'tsuccessful. Everything as usual.

Here my .dpr:

program mHilfe;

uses
Forms,
unit1_mh in 'unit1_mh.pas' {Form1},
RVGrCache;



{$R *.RES}

begin
RichViewMaxPictureCount := 100000;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

By the way Is there a function to know the actual (tatsächliche) size of a memo.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: time passed until first typed letter appeared in memo.

Post by Sergey Tkachenko »

Does the same problem happen in ActionTest project, or only in your project?

Unfortunately, there are no function that return the amount of memory used by the editor. The editor allocates many objects, and nobody calculates their total size. Moreover, because of image caching, the amount of allocated memory may change even on scrolling (because some images are activated, some are deactivated).
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: time passed until first typed letter appeared in memo.

Post by j&b »

In other words, you can't do anything against the delay until first letter appears ?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: time passed until first typed letter appeared in memo.

Post by Sergey Tkachenko »

I still do not understand why it may happen.
Are these image resized?
Also, I which graphic classe is used for them? May be you send me RVF file containing some reasonable count of images, I'll multiply them for testing.

And this delay may be caused by your code in events, what's why I ask about reproducing it in an unmodified ActionTest demo.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: time passed until first typed letter appeared in memo.

Post by j&b »

Trials confirmed the assumption that the number of images in the memo is responsible for the delay.

procedure TForm1.MemoEnter (Sender: TObject);
var i, picZae: integer;
begin
   // ...

   for i: = 0 to Memo.ItemCount-1 do
     if Memo.GetItemStyle (i) = rvsPicture then inc (picZae);
   pStatusbar.Caption: = 'Number of images:' + intToStr (picZae);
   if picZae> 10 then memo.InsertText ('', false);

end;

Is there a better solution than the line in the procedure TForm1.MemoEnter ?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: time passed until first typed letter appeared in memo.

Post by Sergey Tkachenko »

I received your file and I need some time to test it.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: time passed until first typed letter appeared in memo.

Post by Sergey Tkachenko »

You use TDBRichViewEdit.
It does some work when the table is moved to an editng state (it stores the field content in a stream, to check later, if it was really changed).
The editor moves database into editing state when you type a character or call any editing method (such as InsertText).

So, when you call InsertText, this processing occurs immediately, without waiting for user actions.

Sorry, it is unavoidable. The only alternative solution is using TRichViewEdit instead of TDBRichViewEdit: load data from field to the editor, start editing, then save modified document to database.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Re: time passed until first typed letter appeared in memo.

Post by j&b »

Thank you for your efforts.

I will try my solution.
So that not every record-change determines the number of images, I have added a button to allow to count images or not
Only in a few memos are a large number of pictures.

Jürgen


procedure TForm1.memoEnter(Sender: TObject);
var i,picZae: integer;
begin
...
if fMemoVerzoegerung= true then begin //Schalter ja/nein
for i := 0 to Memo.ItemCount-1 do
if Memo.GetItemStyle(i)=rvsPicture then inc(picZae);
if picZae>10 then memo.InsertText('',false);
end;
Post Reply