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

How to focus a selected record in a TListView

I'm not sure if Im missing something obvious here, but is there a way to focus a selected item in a listview, and actually move the scrollbars down to put it in the screen?

I've got ListView.Selected, and if I move my scroll bars down manually, I can see the record is selected.

Problem is I can't seem to get the listview to actually move down to the selected record and automatically display it by moving its own scrollbars.

What am I missing?
0
mikelittlewood
Asked:
mikelittlewood
  • 3
1 Solution
 
ZhaawZSoftware DeveloperCommented:
use TListView().Selected.MakeVisible(false);
0
 
BlackTigerXCommented:
supposing you wanted to make item 10 focused:

  ListView1.Items[10].MakeVisible(True);
  ListView1.Items[10].Selected:=True;
  ListView1.SetFocus
0
 
BlackTigerXCommented:
if you only want it focused, but not selected, change

ListView1.Items[10].Selected:=True;
by this:
ListView1.Items[10].Focused:=True;

try with both and see the difference

best regards
EberSys
0
 
mikelittlewoodAuthor Commented:
ah ha !

thanks guys
0
 
BlackTigerXCommented:
???
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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