Ranorex

ListView in a tab control

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore
View previous topic :: View next topic  
Author Message
Nik



Joined: 29 Sep 2006
Posts: 18

PostPosted: Wed Oct 04, 2006 1:38 am    Post subject: ListView in a tab control
Hi,
I have a dialog box application in which I have a tab control. Each tab has a listview in it. I want to access the list view item. How to do that?

Currently, I am getting handle to a main window-> Handle to a tab control -> Handle to a list view -> and calling RxListViewGetItemCount().
But the function returns 0 even if the list view contains 10 items.

I am using using VC++ 6.0 on Windows XP.
Please opine.

Thanks.
Nikhil
Back to top
View user's profile Send private message
Nik



Joined: 29 Sep 2006
Posts: 18

PostPosted: Wed Oct 04, 2006 6:57 pm    Post subject: Re: ListView in a tab control
Hi,
I found the solution. As per my understanding, it looks like a bug in Ranorex.
I used
HWND hTabControl1 = RxFormFindChildClassName(form, "SysTabControl32", 1);
HWND hTree = RxFormFindChildClassName(hTabControl1, "SysTreeView32", 1);

With this I get the handle to a treecontrol in the last tab. I thought I'll get the tree handle in the first tab.

So the workaround is to set index on the second tab with
RxTabControlSetSelectedIndex (hTabControl1, 1);
and then
call RxTabControlSetSelectedIndex (hTabControl1, 0);
to set the first tab as the current tab.
Once you do this, you can get the handle of treecontrol in the first tab.

Please opine.
-Nikhil


Nik wrote:
Hi,
I have a dialog box application in which I have a tab control. Each tab has a listview in it. I want to access the list view item. How to do that?

Currently, I am getting handle to a main window-> Handle to a tab control -> Handle to a list view -> and calling RxListViewGetItemCount().
But the function returns 0 even if the list view contains 10 items.

I am using using VC++ 6.0 on Windows XP.
Please opine.

Thanks.
Nikhil
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Thu Oct 05, 2006 11:08 pm    Post subject:
Nik wrote:
With this I get the handle to a treecontrol in the last tab. I thought I'll get the tree handle in the first tab.

You should only find a control with ClassName and instance number if you have no other possibility. It's better to use FormFindControlId or the Element functions. ClassName and instance number are not unique identifier. Ranorex goes through all children of a control, reads ControlName, ControlId, ClassName and increments the instance number for each child with the same ClassName. There are no rules, which control gets the first instance number if you have more the one children.

But i know the problem, in older applications the controls have sometimes no ControlName and no unique ControlId.

Jenö Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexCore All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum