Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TListView preventing unselecting all

Posted on 2004-03-31
2
Medium Priority
?
246 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 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

876 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