Why not use the OnSelectItem() event and simply ignore the events where the "Selected" parameter is FALSE ?
The only possible complication I foresee then is if you need to support the user selecting "nothing" (i.e. un-selecting any current selection and leaving the control with no selected item). On 28 July 2014 08:08, Eric A <eaa...@hotmail.com> wrote: > Yes, could do that, with the understanding that it will result in some > extra overhead due to fetching two lots of child records if I don't detect > which is the last non-nil item notified. That's what I meant by "messy". > > ------------------------------ > From: robo...@gmail.com > Date: Sun, 27 Jul 2014 20:57:40 +0200 > > To: delphi@listserver.123.net.nz > Subject: Re: [DUG] ListView - Scroll Event > > So you just need to use the OnChange event, and check the item is not nil. > From memory I don't think you need to check whether item is different to > previous item. > > Robo > > > On Sun, Jul 27, 2014 at 8:52 PM, Eric A <eaa...@hotmail.com> wrote: > > Yes, multiple OnChange events are generated on the ListView control, for > both mouse clicks and navigation key depressions, as follows: > > a) First mouse click or down arrow/PgDn key depression: > - Item = new selection > > b) subsequent mouse clicks or down arrow/PgDn key depressions: > - Item - current selection > - Item= nil > - Item = new selection > > Seems messy ... > > ------------------------------ > From: robo...@gmail.com > Date: Sun, 27 Jul 2014 12:28:33 +0200 > To: delphi@listserver.123.net.nz > > Subject: Re: [DUG] ListView - Scroll Event > > From memory, when a record changes, first an event gets fired where > selected item is nil, then a second event gets fire where selected item is > the new item. > > > On Sun, Jul 27, 2014 at 11:07 AM, Eric A <eaa...@hotmail.com> wrote: > > (Delphi 7) > > I wish to detect the user selecting a row (item) in a ListView component > to display child records for the item in another control. > > There is no "OnScroll" event for this control. I can use the "OnClick" > event OK for a selection cia the mouse, but how do I detect when a user > scrolls on to a record by using the arrow keys (or PgUp, PgDn or moving the > scrollbar ? > > I have tried the using the OnChange event but it seems that there are two > events generated for each movement by the arrow keys. > > Does anyone have a code snippet to accomplish this? > > Eric. > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@listserver.123.net.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with > Subject: unsubscribe > > > > _______________________________________________ NZ Borland Developers > Group - Delphi mailing list Post: delphi@listserver.123.net.nz Admin: > http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email > to delphi-requ...@listserver.123.net.nz with Subject: unsubscribe > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@listserver.123.net.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with > Subject: unsubscribe > > > > _______________________________________________ NZ Borland Developers > Group - Delphi mailing list Post: delphi@listserver.123.net.nz Admin: > http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email > to delphi-requ...@listserver.123.net.nz with Subject: unsubscribe > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@listserver.123.net.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with > Subject: unsubscribe >
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@listserver.123.net.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with Subject: unsubscribe