Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to focus a selected record in a TListView

Posted on 2004-09-16
5
275 Views
Last Modified: 2010-04-05
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
Comment
Question by:mikelittlewood
  • 3
5 Comments
 
LVL 11

Accepted Solution

by:
ZhaawZ earned 50 total points
ID: 12077397
use TListView().Selected.MakeVisible(false);
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12079914
supposing you wanted to make item 10 focused:

  ListView1.Items[10].MakeVisible(True);
  ListView1.Items[10].Selected:=True;
  ListView1.SetFocus
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12079920
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
 
LVL 15

Author Comment

by:mikelittlewood
ID: 12083100
ah ha !

thanks guys
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12088620
???
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
error 1.1 400 Bad request idhttp delphi 18 148
Intraweb download file link ? 1 156
Convert a string into a TDateTime 5 64
can't find the executable in Simulator 1 100
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question