Andrew Haines wrote:
George Lober wrote:
Andrew Haines wrote:
George Lober wrote:
Marc Weustink wrote:
George Lober wrote:
Hi all,
1) Can someone tell me how to make TListView scroll to and show
the topmost item of a list in the top line of the TListView window?
2) How do you scroll to and show a particular item on the top
line of the TListView window ?
ListItem.MakeVisible (or was it EnsureVisible ?)
This won't set the topitem, but it makes it visible atleast.
Yes, that's what I've been using, but like you say it won't set the
top item. It may or may not end up being on top, depending on where
you're scrolling from.
Use makevisible on the last item first.
Listview1.BeginUpdate;
with ListView1 do Items.Item[Items.Count-1].MakeVisible(False);
MyItem.MakeVisible(False);
ListView1.EndUpdate;
Don't quite follow what seems like reverse logic, but it works
great! Thanks for your example Andrew.
George
1) we tell the ListView to not redraw itself with BeginUpdate;
2) we scroll to the last item in the listview this means that we will
have to scroll up to the item you want to
I think it's kind of counter-intuitive to scroll to something when it's
being made not-visible.
3) we scroll to the item we want. because we are scrolling up from the
bottom, the item we want will be in the top of the screen
Now that I have properly visualized it, I do understand that point. I
just thought you had to scroll from the top to get it to show at the top.
4) we tell the listview it can resume drawing with EndUpdate
Hope this clears it up ;)
Andrew
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives