Solved

Select All in listview

Posted on 2000-02-14
12
167 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

830 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