Scrolling in List View

Class library usage, coding and language questions.
Nik
Posts: 18
Joined: Fri Sep 29, 2006 1:35 am

Scrolling in List View

Post by Nik » Wed Oct 25, 2006 12:37 am

Hi,
I have a List view which has around 50 item. I have to click eack item which in turn displays more information about the item.
I am using the element approach to click the items in the list view. The problem is that list view does not display all the item. It displays around 10 items and then you have to use scroll bar to see the other items.

How should I implement this? When I use the element approach I can highlight the item but I am not able to click on the item down in the list view.

Also, tree view does not scroll to the highlighhted item by itself.

Please suggest. I am using VC6.0 on Win XP.

-Nikhil

Nik
Posts: 18
Joined: Fri Sep 29, 2006 1:35 am

Re: Scrolling in List View

Post by Nik » Wed Oct 25, 2006 6:02 pm

Please read tree view as list view. Typo mistake.

-Nikhil

Nik wrote:Hi,
I have a List view which has around 50 item. I have to click eack item which in turn displays more information about the item.
I am using the element approach to click the items in the list view. The problem is that list view does not display all the item. It displays around 10 items and then you have to use scroll bar to see the other items.

How should I implement this? When I use the element approach I can highlight the item but I am not able to click on the item down in the list view.

Also, tree view does not scroll to the highlighhted item by itself.

Please suggest. I am using VC6.0 on Win XP.

-Nikhil

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Wed Oct 25, 2006 9:56 pm

You are right, SELFLAG_TAKESELECTION doesn't scroll the item into view.
It works with ListBox and TreeView but it does not work with a ListView.
It seems to be a Microsoft bug, we will try to find a workaround for the next version.

But you can easily solve the problem with a little trick, send a LEFT keypress event after the item selection. This will scroll the item into view.

Code: Select all

for(int i=0; i< childCount; i++)
{
  if ( RxElementGetChild(&listElement, i, &listItem) == TRUE )
  {
    RxElementSelect(&listItem, SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION);
    RxControlSendKeys(hListView,"{LEFT}");
    RxSleep(300);
  }
}
Jenö Herget
Ranorex Team

Nik
Posts: 18
Joined: Fri Sep 29, 2006 1:35 am

Post by Nik » Fri Oct 27, 2006 5:45 am

It worked for me.
Thanks
Nikhil