Page 1 of 1

Scrolling in List View

Posted: Wed Oct 25, 2006 12:37 am
by Nik
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

Re: Scrolling in List View

Posted: Wed Oct 25, 2006 6:02 pm
by Nik
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

Posted: Wed Oct 25, 2006 9:56 pm
by webops
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

Posted: Fri Oct 27, 2006 5:45 am
by Nik
It worked for me.
Thanks
Nikhil