Link to home
Start Free TrialLog in
Avatar of trevorb
trevorb

asked on

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.
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi trevorb,

try

  Listview1.ItemFocused.MakeVisible(False);

meikl
Avatar of Epsylon
Epsylon

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.

ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops,
sorry eps,
didn't see your comment,
well, this may also a possibility
meikl
Avatar of trevorb

ASKER

Cheers everyone!
Trevor