How to ensure last line of TListBox is showing? lazarus / 7-LCL ---------------------------------------------------------------------- tech-pro · 2008-02-01 17:58 I have a debug window that is showing the communication in and out of the serial port. The data is displayed in a TListBox and I need to scroll the listbox so that the last line of data is always showing. I know that setting TopIndex will force the listbox to show the last entries, but I can't see how to determine how many lines fit in the window. Under Windows, it is easy, because the font is standard and the number of lines probably won't change, so I could hard code it. But this program will be compiled for Linux as well and the font can be changed by the user. I thought ItemHeight might give the height of a line in pixels, which I could devide into the list box height, but under Windows anyway (which I'm working in now) it appears to return the value zero. ---------------------------------------------------------------------- antonio · 2008-02-07 20:48 Code: [Select] listbox1.items.add(inttostr(listbox1.items.count+1));//adds an item listbox1.itemindex := listbox1.items.count -1;//selects the last item