Hi,
you could try to use ViewOrigin property along with Scroll method
of TListView to make a certain item the first one that's visible.
HTH
(
--
Florian Haag
ICQ: 114504497
http://private.addcom.de/h/haag/fh/
> How can I set the TopItem property of a TListView?
Not sure. But if you are only trying to make sure that a certain item is
visible, use TListItem.MakeVisible.
Of course you can use the value in TopItem (or use the message
LVM_GETTOPINDEX to get the top index) and then scroll up or down.
--
Rudy Velthuis (TeamB)
There is no direct way to do that. YOu can use a TLIstitems MakeVisible
method to scroll it into view, but you have no control over where it
will end up.
You can "manually" scroll the listview by sending it WM_VSCROLL
messages:
Procedure ScrollItemtoTop( lv: TLIstview; index: Integer );
var
num: Integer;
scrollcode: Integer;
begin
num := lv.TopItem.Index - index;
If num < 0 Then Begin
scrollcode := SB_LINEDOWN;
num:= Abs(num);
End
Else
scrollcode := SB_LINEUP;
lv.Items.BeginUpdate;
Try
While num > 0 Do Begin
lv.Perform( WM_VSCROLL, scrollcode, 0 );
Dec(num);
End;
lv.Perform( WM_VSCROLL, SB_ENDSCROLL, 0 );
Finally
lv.Items.EndUpdate;
End; { Finally }
end;
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.
ListView.Items[iTopRow +
ListView.VisibleRows].MakeVisible(False);
ListView.Items[iTopRow].MakeVisible(False);
"Peter Gore" <pe...@gorehome.freeserve.co.uk> wrote in message
news:3c009215$1_1@dnews...