Solved

Listview and selected

Posted on 2002-06-19
1
285 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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