[DUG] ListView - Scroll Event

John Bird johnkbird at paradise.net.nz
Mon Jul 28 02:24:33 NZST 2014


Haven’t tried with Listview, but in stringgrid and listbox, checkbox etc the onclick event fires with the mouse, or on moving with the arrow key (D2007).  (As long as there is a current element its more or less logical to have a click event also respond to the keyboard as it wouldn’t be much use otherwise).  I have used stringrids and listboxes to do exactly what you want – as current record changes in the first to show more detail in a second control.

(With data controls often the best approach is to use the change event on the datasource to detect the same thing).

So try the onclick event some more.

From: Eric A 
Sent: Sunday, July 27, 2014 9:07 PM
To: Delphi ListServer 
Subject: [DUG] ListView - Scroll Event

(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 at listserver.123.net.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at listserver.123.net.nz with Subject: unsubscribe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20140728/e668a1a0/attachment.html 


More information about the Delphi mailing list