[Lazarus] How to fix slow screen refresh of TListbox?

Bo Berglund bo.berglund at gmail.com
Fri Nov 11 23:37:14 CET 2022


On Fri, 11 Nov 2022 18:49:15 +0100, Luca Olivetti via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>Play with the properties in the project inspector, you can remove the 
>gutter (gutter.visible -> false), the margin (by setting RightEdge to a 
>very big value, say 800) and customize much of its appearance..
>
I replaced the TListBox with a TSynEdit as suggested and I have "played with"
the properties a bit.
Seems to work quite well so far.

>
>Me too. Just set the readonly property to true and that's it.
>Then just treat it like a TMemo (using the Lines property). It has some 
>more goodies that aren't available in a Tmemo.
>As I said, I was using a TMemo for logging and it was too slow under 
>windows, I switched to a TSynEdit and had great improvement in performance.
>
I have a couple of questions:

1) Is there a way to make sure that when adding text the view shifts such that
the last line is visible?
I.e. Automatically scroll the text up when new text is added.

2) The reason I am not adding incoming data to the listbox as tyhey arrive is
that I don't know if the serial component provides the data at line endings or
in the middle of a line, so I add the data to the old data in the TBytes array
and then dump the content of the TBytes into the text property of the box.

What happens if one adds the text as a block to this synedit where the block
does not end in a line feed?
Will the end of it be some way into the last line such that if I then add the
next transmission it will start at tahat position and not on a new line?

If that is possible then the handling will become a lot easier since I just have
to add the few new lines at the end directly in synedit...

I'll test that too.
But how to jump to the end of the text on screen?

-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list