Solved

TListView preventing unselecting all

Posted on 2004-03-31
2
242 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 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

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.

Question has a verified solution.

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

Suggested Solutions

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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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