[Lazarus] Memo.Lines.BeginUpdate

Martin lazarus at mfriebe.de
Fri Mar 8 15:35:02 CET 2013


On 08/03/2013 14:08, Juha Manninen wrote:
> On Fri, Mar 8, 2013 at 3:43 PM, Vincent Snijders
> <vincent.snijders at gmail.com> wrote:
>>> Method number 1. is about 40 times faster!
>>> I expected method number 2. to be the fastest.
>> Why? There is lot of comminucation between the LCL and widgetset, even
>> if the widgetset doesn't paint any update with method 2.
> Well, I would consider this as a bug. A 40 times difference is big!
> I have used BeginUpdate / EndUpdate often and they usually help to
> obtain a fast GUI. I didn't make exact timings though.
> Now, is this a well known issue and the right way is to always assign
> data from a temp list?
>

I don't know in case of a TMEmo, but I guess there will be similar 
reasons.  Consider that with a SynEdit.

If you insert/add lines to a SynEdit (inside BeginUpdate), there is 
still work it needs to do.
Like it you insert before the caret, then the caret must still move. It 
will not be painted, but it must move. If wait and try to do that after 
EndUpdate you may get a different position.

Examble: caret is one before end of  line, and caret is not allowed past EOL
BeginUpdate
   abcdef|g
delete some chars at begin of line (caret moves
   f|g
insert at EOL
   f|g123456
EndUpdate

But if you did not move during BeginUpdate he caret then it would end up 
on a diff position.
Actually accessing SynEdit.Lines will skip that, But thats another story....

Point is the widget may have reasonable work to do, even if Updating




More information about the Lazarus mailing list