• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Scrolling a ListView

If I select an item in a ListView manually (i.e. via code rather than clicking) how can I scroll the ListView to make that item visible (within the viewable area)?

Cheers, Trevor.
0
trevorb
Asked:
trevorb
  • 3
1 Solution
 
kretzschmarCommented:
hi trevorb,

try

  Listview1.ItemFocused.MakeVisible(False);

meikl
0
 
EpsylonCommented:
This will put item 67 at the top of the listview (if there are enough items):

with ListView1 do
begin
  Items[67].Selected := true;
  Scroll(0, Selected.Position.y - TopItem.Position.y);
end;

This only works with report style...

Epsylon.

0
 
kretzschmarCommented:
hi again,

sorry correction

  ListView1.Selected.MakeVisible(False);

meikl ;-)
0
 
kretzschmarCommented:
oops,
sorry eps,
didn't see your comment,
well, this may also a possibility
meikl
0
 
trevorbAuthor Commented:
Cheers everyone!
Trevor
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now