Solved

Select All in listview

Posted on 2000-02-14
12
166 Views
Last Modified: 2010-04-04
how can i select all in listview with one click
0
Comment
Question by:esk
  • 5
  • 4
  • 3
12 Comments
 
LVL 5

Expert Comment

by:TheNeil
ID: 2518740
Can you use the OnClick method and simply select everything in that?

The Neil
0
 

Author Comment

by:esk
ID: 2518924
i want to push a button, after that it selects all in this listview
0
 

Author Comment

by:esk
ID: 2518927
this is like multiselect , but i push a button and it select self all item
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 6

Expert Comment

by:Jaymol
ID: 2518972
Simple, but does what you asked for...

procedure TForm1.Button1Click(Sender: TObject);
var
  TmpI : Integer;
begin
  For TmpI:=0 to ListBox1.Items.Count-1 do
  ListBox1.Selected[TmpI]:=True;
end;

Hope this helps,

John.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2518986
Doh!!!  Sorry.....You said listview, not listbox....

For TmpI:=0 to ListView1.Items.Count-1 do
ListView1.Items[TmpI].Selected:=True;
ListView1.SetFocus;

That'll do the trick!

John.
0
 
LVL 5

Accepted Solution

by:
TheNeil earned 50 total points
ID: 2518993
Create your button then add something along the lines of the following:

VAR
  iCount : INTEGER;
begin
  FOR iCount := 0 TO (ListView1.Items.Count - 1)
  DO
    ListView1.Items[iCount].Selected := TRUE;
  ListView1.SetFocus;
end;

The Neil
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2519003
p.s. Make sure you set the MultiSelect property of your TListView to TRUE else it won't work

The Neil
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2519018
Ha!  (Forgot to mention MultiSelect though!)

John.
0
 

Author Comment

by:esk
ID: 2519258
work!!!
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2519289
Thanks Esk,

Sorry John - looks like I won this time

The Neil
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2522175
This is pathetic.  I'm getting pissed off with you so called Experts.
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2522179
Who answered you first?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
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…

772 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