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

2022-11-20 Thread Flávio Etrusco via lazarus
Em dom., 20 de nov. de 2022 04:23, Bo Berglund via lazarus <
lazarus@lists.lazarus-ide.org> escreveu:

> On Fri, 18 Nov 2022 18:40:57 -0300, Flávio Etrusco via lazarus
>  wrote:
>
> >Em dom., 13 de nov. de 2022 às 18:36, Luca Olivetti via lazarus <
> >lazarus@lists.lazarus-ide.org> escreveu:
> >
> >> El 12/11/22 a les 12:13, Bo Berglund via lazarus ha escrit:
> >> > On Sat, 12 Nov 2022 09:45:15 +0100, Luca Olivetti via lazarus
> >> >  wrote:
> >> >
> >> >> El 11/11/22 a les 23:37, Bo Berglund via lazarus ha escrit:
> >> >>
> >> >>> But how to jump to the end of the text on screen?
> >> >>>
> >> >>
> >> >> TheSynEdit.TopLine:=TheSynEdit.Lines.Count-TheSynEdit.LinesInWindow+1
> >> >>
> >> >
> >> > Did not work, but this does work:
> >>
> >> Strange, I've been using it for many years (and still use it) to ensure
> >> the last line is visible.
> >>
> >> (...)
> >> --
> >> Luca Olivetti
> >> Wetron Automation Technology http://www.wetron.es/
> >> Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
> >>
> >
> > It should work. Or even straight
> >"TheSynEdit.TopLine:=TheSynEdit.Lines.Count;'.
>
> My current version of my logging tool application uses this to display
> incoming
> data on the serial port (where it ends up in the TBytes buffer DataBuffer[]
> before displaying):
>
> ...
>   SetLength(DataTxt, Length(DataBuffer)); //Set string length
>   Move(DataBuffer[0], DataTxt[1], Length(DataBuffer)); //Copy data to
> string
>   {$ifdef USESYNEDIT}
> synRxData.Lines.Beginupdate;
> synRxData.Lines.Text := DataTxt;
> synRxData.CaretY := synRxData.Lines.Count;
> synRxData.Lines.Endupdate;
> stxLineCount.Caption := IntToStr(synRxData.Lines.Count);
>   {$else}
> ...
>

I see. My point is that you don't need to copy the whole DataBuffer and
re-populate the whole SynEdit each time you receive new data. But this
probably won't matter much unless you have hundreds of thousands of lines
running on not so recent hardware.

Best regards,
Flávio

>
>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


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

2022-11-20 Thread Bo Berglund via lazarus
On Sun, 20 Nov 2022 18:21:56 -0300, Flávio Etrusco via lazarus
 wrote:

>I see. My point is that you don't need to copy the whole DataBuffer and
>re-populate the whole SynEdit each time you receive new data. But this
>probably won't matter much unless you have hundreds of thousands of lines
>running on not so recent hardware.

Well, I tried at first to add incoming data to the bottom of the window, but it
turned out that when the transfer of data had been cut into parts by the serial
buffer such that the OnRxdata() triggered several times during the transfer then
the line at which the trigger happened was cut in two in the middle of the
screen.

Apparently the extra line break that was not part of the transfer was added by
the control when the data was added to the end. Next data added to it was not
adjacent to the last previous character but placed on the start of the next
line...

So the data in the synedit always ended with a linefeed even though there was
not yet any such in the transfered data.

Therefore I decided to use a dynamic TBytes array, which I could expand the size
of whenever the data arrived to fit the new packet and put it at the end of the
buffer.
Then I just replaced the strings in the display control with the full buffer
every time.
This way lines are not visibly cut in half or worse

But it would be better if I could have kept the data in the SynEdit itself and
just expanded with new data as they arrived by putting them at the end...

Not so much to transfer then.
Just new arriving text.


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


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

2022-11-20 Thread Vojtěch Čihák via lazarus

It wouldn't be that hard to write custom component based on TGraphicControl + 
TBitmap with built-in bitmap font. Copying bitmap letters will be faster than 
rendering from ttf.
 
V.
__

Od: "Bo Berglund via lazarus" 
Komu: lazarus@lists.lazarus-ide.org
Datum: 11.11.2022 16:29
Předmět: [Lazarus] How to fix slow screen refresh of TListbox?



Now I wonder if there is some way to do as I did when I worked in Delphi with
TListView objects, where I could use the BeginUpdate and EndUpdate calls to make
all screen updates wait until it was all put in place.
This was MUCH faster!

But I can not find a BeginUpdate on the TListBox object, only BeginUpdateBounds,
which does not tell me much

Any suggestions?


--
Bo Berglund
Developer in Sweden

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus 


-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


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

2022-11-20 Thread Jean SUZINEAU via lazarus
Maybe you could add a buffer in your flow of data, storing the incoming 
data ?
When a line ending arrives, you can flush your buffer to Synedit up to 
the line ending, keeping in the buffer just the end of the data not yet 
terminated by a line ending.

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus