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

x
?
Solved

Listview and selected

Posted on 2002-06-19
1
Medium Priority
?
291 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 400 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: 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

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…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

824 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