Solved

TListView preventing unselecting all

Posted on 2004-03-31
2
237 Views
Last Modified: 2010-04-05
Hi all,

I need a ListView that always has a selection. The problem is that when the user clicks the blank area of the ListView (the area that remains below all items when the ListView is large enough) all items get deselcted. I want the last item selected to remain selected. The ListBox already works this way but I can't get the ListView to behave this way.

Regards Jacco
0
Comment
Question by:Jacco
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 250 total points
ID: 10729810
maybe this way?

procedure TForm1.ListView1Click(Sender: TObject);
begin
  if not assigned(listview1.Selected) then
  begin
    listview1.Selected := listview1.Items[listview1.Items.Count-1];
    //maybe also needed
    listview1.ItemFocused := listview1.Selected;
  end;
end;


meikl ;-)
0
 
LVL 10

Author Comment

by:Jacco
ID: 10730066
Thanks Meikl!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now