I tried the same type of function with Selected and no tracks appear selected even though they physically appear selected. Ctrl Click works but not when a range of tracks are selected using Shift Click.
I suspect the OnSelectItem event is firing too early when the listview is virtual. Ross. -----Original Message----- From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf Of se_work Sent: Wednesday, 5 January 2011 1:14 AM To: delphi@elists.org Subject: Re: Bug on selcount for Virtual TlistView Hi, I am using this function to check the checked items if you defined your List with checked items. (D5) function NbCheckedItem (MyListview: Tlistview): Integer; var i: Integer; begin Result :=0; for i:=0 to MyListview.Items.Count-1 do if MyListview.Items[i].Checked then Result := succ(Result); end; I have a list of function to help to select and multiselect, unselect, check selected etc.... I prefer to work with checked items to process actions. best On Tue, Jan 4, 2011 at 2:00 PM, <delphi-requ...@elists.org> wrote: > Send Delphi mailing list submissions to > delphi@elists.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.elists.org/cgi-bin/mailman/listinfo/delphi > or, via email, send a message with subject or body 'help' to > delphi-requ...@elists.org > > You can reach the person managing the list at > delphi-ow...@elists.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Delphi digest..." > > > Today's Topics: > > 1. Virtual TListView SelCount bug (Ross Levis) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 4 Jan 2011 18:02:16 +1300 > From: "Ross Levis" <r...@stationplaylist.com> > Subject: Virtual TListView SelCount bug > To: "Delphi Discussion List" <delphi@elists.org> > Message-ID: <007301cbabcc$90171120$b04533...@com> > Content-Type: text/plain; charset="us-ascii" > > In D7, I'm using a Virtual ListView (OwnerData=true) for the first time in > a > project, and there appears to be a bug in the VCL. I'm hoping I can make a > fix in the VCL code if possible. > > > > I've searched the internet and found a person asking the same question on a > forum but no one answered him. > > > > The ListView is MultiSelect. When using Shift Click to select multiple > items, the SelCount property returns 0. When using Ctrl Click to select > multiple items individually then SelCount is correct. > > > > I would rather not traverse all the items to check the selected state as > this could be in the hundreds of thousands. Does anyone know of a fix? > > > > Many thanks. > > Ross. > > > > ------------------------------ > > _______________________________________________ > Delphi mailing list > Delphi@elists.org > http://lists.elists.org/cgi-bin/mailman/listinfo/delphi > > > End of Delphi Digest, Vol 11, Issue 1 > ************************************* > _______________________________________________ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi _______________________________________________ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi