Solved

Listview and selected

Posted on 2002-06-19
1
286 Views
Last Modified: 2010-04-04
I like to have A listview, a TEdit and a TButton.

What I like to do is to be able to select (multiselect ) things in the listView and then type in a number in the
TEdit and push the button. What I like to happen is to
have the SUbitems[2] set to TEdit.Text for the selected items.

I have 2 questions though. When I try to do this the listview always lose the selection when I step into the EditBox or when I push the button... how can I prevent this to happen?

And how do I go through all Selected Items and set the Subitems[2] to TEdit.Text?
0
Comment
Question by:wqclatre
1 Comment
 
LVL 3

Accepted Solution

by:
raidos earned 100 total points
ID: 7092062
This appears to work...

On the button click event.. add this..

Var
  Loop : Integer;
  Item : TListItem;
begin
  Item := ListView1.Selected;
  For Loop := 0 To ListView1.SelCount-1 Do Begin
    Item.SubItems[2] := Edit1.Text;
    Item := ListView1.GetNextItem(Item, sdAll, [isSelected]);
  End;
end;

about the selection loosing try setting the HideSelection property of the listview to false..

Regards
//raidos
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…

829 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