Solved

Listview and selected

Posted on 2002-06-19
1
282 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now