Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TListView preventing unselecting all

Posted on 2004-03-31
2
Medium Priority
?
245 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
[X]
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
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

705 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