boardtc
asked on
TListView virtual mode & Selected
I have a TListView in virtual mode. I set the Selected property to an item outside the current listbox. If U scroll down the list I can see the new item selected ?_but_ how can I get the list box to automatically move it's view on the TCollection down to include the new selected (via code) item.
Thanks, Tom.
Thanks, Tom.
I'm not sure whether the "Items" property works completely, when using virtual mode. I'm using the following function when doing virtual mode:
ListView_EnsureVisible
Regards, Madshi.
ListView_EnsureVisible
Regards, Madshi.
Hmm... yeah, forgot about that.
Didn't try it myself, but you just *might* get a List Index Out of Bounds error.
So Tom, Madshi is correct, just follow his suggestion and call it this way:
ListView_EnsureVisible(Lis tView1.Han dle, myIndex, False);
and don't forget to add CommCtrl in your uses clause.
(PS: If this works, give the points to Madshi)
Didn't try it myself, but you just *might* get a List Index Out of Bounds error.
So Tom, Madshi is correct, just follow his suggestion and call it this way:
ListView_EnsureVisible(Lis
and don't forget to add CommCtrl in your uses clause.
(PS: If this works, give the points to Madshi)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It turns out that
ListView1.Items[myIndex].M akeVisible (False);
is a wrap for
ListView_EnsureVisible(Lis tView1.Han dle, myIndex, False);
so both work perfectly :-)
There doesn't seem to be any advantage to using the later.
FYI, ListView1.TopItem is readonly.
The selected index however shows at the bottom of the TListView and I want it toward the top. I want to do
ListView1.Items[myIndex+Nu mberItemsV isibleInLi st].MakeVi sible(Fals e);
Do ye have any idea how I can get
the number of items visible in the list?
Thanks a million, Tom.
ListView1.Items[myIndex].M
is a wrap for
ListView_EnsureVisible(Lis
so both work perfectly :-)
There doesn't seem to be any advantage to using the later.
FYI, ListView1.TopItem is readonly.
The selected index however shows at the bottom of the TListView and I want it toward the top. I want to do
ListView1.Items[myIndex+Nu
Do ye have any idea how I can get
the number of items visible in the list?
Thanks a million, Tom.
ListView_GetCountPerPage
ASKER
Thanks for you guys help. Great, Tom.
ListView1.Items[myIndex].M
or
ListView1.TopItem := ListView1.Items[myIndex];