Recent

Author Topic: [SOLVED] Autoscroll listbox  (Read 622 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 951
[SOLVED] Autoscroll listbox
« on: November 15, 2022, 01:05:24 pm »
How to scroll a listbox to the last item?
« Last Edit: November 20, 2022, 02:00:03 pm by pcurtis »
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

itblumi

  • New Member
  • *
  • Posts: 29
Re: Autoscroll listview
« Reply #1 on: November 15, 2022, 01:13:14 pm »
Have a look at this topic https://forum.lazarus.freepascal.org/index.php?topic=51257.0 maybe it helps you allready
Jan

Delphi XE6, Lazarus 2.2.4, Visual Studio, Eclipse
Platforms: Ubuntu 22.10, Windows 7, 10
Progarmming languages: Pascal, C, C++, C#, Java

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: Autoscroll listbox
« Reply #2 on: November 15, 2022, 01:28:57 pm »
sorry I meant listbox
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

itblumi

  • New Member
  • *
  • Posts: 29
Re: Autoscroll listbox
« Reply #3 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.  
Jan

Delphi XE6, Lazarus 2.2.4, Visual Studio, Eclipse
Platforms: Ubuntu 22.10, Windows 7, 10
Progarmming languages: Pascal, C, C++, C#, Java

jamie

  • Hero Member
  • *****
  • Posts: 6131
Re: Autoscroll listbox
« Reply #4 on: November 15, 2022, 02:05:13 pm »
ListBox.MakeCurrentVisable

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

The only true wisdom is knowing you know nothing

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: [SOLVED] Autoscroll listbox
« Reply #5 on: November 20, 2022, 02:01:46 pm »
@itblumi - Thanks
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

 

TinyPortal © 2005-2018