Back to the first question. You can append your data with lb.items.text. Just prepare your data in a string like this: strtmp:=data1+lineending+data2+lineending+..... And append lb.items.text:=lb.items.text+lineending+strtmp Yes it is a workaround but do the trick like beginupdate Ciao
Ottieni BlueMail per Android Il giorno 11 Nov 2022, 16:29, alle ore 16:29, Bo Berglund via lazarus <lazarus@lists.lazarus-ide.org> ha scritto: >I am using a TListbox component on a form for displaying debug data >arriving >over a serial line at 115200 baud. >The data are a set of MQTT telegram texts which arrive in packets of >about 40 >lines each time (once per 10 seconds). >I add them to the listbox as follows: > >procedure THanSimulatorMain.OnRxData(Sender: TObject; const Data: >TBytes); >var > len, oldlen: integer; > DataTxt: AnsiString; >begin > len := Length(Data); //Incoming packet > oldlen := Length(DataBuffer); > SetLength(DataBuffer, oldlen + len); > Move(Data[0], DataBuffer[oldlen], len); > SetLength(DataTxt, Length(DataBuffer)); > Move(DataBuffer[0], DataTxt[1], Length(DataBuffer)); > lbxRxData.Items.Text := DataTxt; //Add the text to the list > lbxRxData.ItemIndex := lbxRxData.Items.Count -1; //To make it visible >end; > >DataBuffer is a global TBytes container where the incoming data are >stuffed as >they arrive (it grows during the session). >You see that the buffer contains the complete log history from the >start... > >I have noticed that after a while the display becomes very sluggish >when data >arrives and I think that is due to the way the component operates. > >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