?
Solved

TListView virtual mode & Selected

Posted on 2002-05-23
7
Medium Priority
?
473 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:boardtc
  • 3
  • 2
  • 2
7 Comments
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 7031077
try something like this?

ListView1.Items[myIndex].MakeVisible(False);

or

ListView1.TopItem := ListView1.Items[myIndex];
0
 
LVL 20

Expert Comment

by:Madshi
ID: 7031201
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.
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 7031279
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(ListView1.Handle, myIndex, False);

and don't forget to add CommCtrl in your uses clause.

(PS: If this works, give the points to Madshi)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 20

Accepted Solution

by:
Madshi earned 200 total points
ID: 7031305
The Items stuff might work, too, sometimes it does work even in virtual mode. Just not sure...
0
 

Author Comment

by:boardtc
ID: 7031676
It turns out that
ListView1.Items[myIndex].MakeVisible(False);
is a wrap for
ListView_EnsureVisible(ListView1.Handle, 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+NumberItemsVisibleInList].MakeVisible(False);

Do ye have any idea how I can get
the number of items visible in the list?

Thanks a million, Tom.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 7032077
ListView_GetCountPerPage
0
 

Author Comment

by:boardtc
ID: 7041280
Thanks for you guys help. Great, Tom.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question