<div dir="ltr">Why not use the OnSelectItem() event and simply ignore the events where the "Selected" parameter is FALSE ?<br><br>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).</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 28 July 2014 08:08, Eric A <span dir="ltr"><<a href="mailto:eaa603@hotmail.com" target="_blank">eaa603@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">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".<br><br><div><hr>From: <a href="mailto:robo555@gmail.com" target="_blank">robo555@gmail.com</a><br>Date: Sun, 27 Jul 2014 20:57:40 +0200<div><div class="h5"><br>To: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Subject: Re: [DUG] ListView - Scroll Event<br><br><div dir="ltr">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.<br>
<br>Robo<br></div><div>
<br><br><div>On Sun, Jul 27, 2014 at 8:52 PM, Eric A <span dir="ltr"><<a href="mailto:eaa603@hotmail.com" target="_blank">eaa603@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Yes, multiple OnChange events are generated on the ListView control, for
both mouse clicks and navigation key depressions, as follows:<br><br>a) First mouse click or down arrow/PgDn key depression:<br>- Item = new selection<br><br>b) subsequent mouse clicks or down arrow/PgDn key depressions:<br>
- Item - current selection<br>- Item= nil<br>- Item = new selection<br><br>Seems messy ...<br><br><div><hr>From: <a href="mailto:robo555@gmail.com" target="_blank">robo555@gmail.com</a><br>Date: Sun, 27 Jul 2014 12:28:33 +0200<br>
To: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><div><br>Subject: Re: [DUG] ListView - Scroll Event<br><br></div><div><div><div dir="ltr">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.<br>
</div><div><br><br><div>
On Sun, Jul 27, 2014 at 11:07 AM, Eric A <span dir="ltr"><<a href="mailto:eaa603@hotmail.com" target="_blank">eaa603@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">(Delphi 7)<br><br>I wish to detect the user selecting a row (item) in a ListView component to display child records for the item in another control. <br><br>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 ?<br>
<br>I have tried the using the OnChange event but it seems that there are two events generated for each movement by the arrow keys.<br><br>Does anyone have a code snippet to accomplish this?<span><font color="#888888"><br>
<br>Eric.<br>                                            </font></span></div></div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>
<br>_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div></div>                                            </div></div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>
<br>_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</div></div></div>                                            </div></div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>