Lazarus

Programming => LCL => Topic started by: pcurtis on November 15, 2022, 01:05:24 pm

Title: [SOLVED] Autoscroll listbox
Post by: pcurtis on November 15, 2022, 01:05:24 pm
How to scroll a listbox to the last item?
Title: Re: Autoscroll listview
Post by: itblumi on November 15, 2022, 01:13:14 pm
Have a look at this topic https://forum.lazarus.freepascal.org/index.php?topic=51257.0 (https://forum.lazarus.freepascal.org/index.php?topic=51257.0) maybe it helps you allready
Title: Re: Autoscroll listbox
Post by: pcurtis on November 15, 2022, 01:28:57 pm
sorry I meant listbox
Title: Re: Autoscroll listbox
Post by: itblumi on November 15, 2022, 01:49:43 pm
You can set the TopIndex(without selecting an item) or the ItemIndex(with selecting an item) of TListBox

Example:
Code: Pascal  [Select][+][-]
  1. ListBox1.TopIndex := ListBox1.Count - 1; // this is without selecting an item
  2.  

Code: Pascal  [Select][+][-]
  1. ListBox1.ItemIndex := ListBox1.Count - 1; // this is with selecting the last item
  2.  
Title: Re: Autoscroll listbox
Post by: jamie on November 15, 2022, 02:05:13 pm
ListBox.MakeCurrentVisable

Set the Index to the last item and call that etc.

Title: Re: [SOLVED] Autoscroll listbox
Post by: pcurtis on November 20, 2022, 02:01:46 pm
@itblumi - Thanks
TinyPortal © 2005-2018