Ranorex

Access to control in Tabcontrol

 
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: Tue Jan 09, 2007 3:21 am    Post subject: Access to control in Tabcontrol
Hi,
I have a tabcontrol with 4 tabs in it. Each tab has listbox, combo box etc.
I have to navigate in all the tabs and dump the data in each of the control.
I am using Element approach but I am not able to dump the data except of the first tab. I am able to select the tabs but not able to grab the access of the controls in the tab.
Here is my code:

RxElementFindChild(elmRoot, ROLE_SYSTEM_PAGETABLIST,
GNTF_NULL, GNTF_NULL, &listElement);

for(each tab)
select tab
RxElementFindChild(&listElement, ROLE_SYSTEM_DIALOG,
GNTF_NULL, GNTF_NULL, &elmNewRoot);
dump the data

Can you please suggest a way to navigate in all the tabs and dump the data using Element approach.

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


Joined: 05 Jul 2006
Posts: 351

PostPosted: Tue Jan 09, 2007 10:46 pm    Post subject:
In an older windows application, written with MFC, you should use the PropertyPage Role:
(See also MSDN Documentation)

Code: click into code to enlarge
ElementStruct element;
RxControlGetElement(form, &element);
int itemCount = ::RxTabControlGetItemCount(htabControl);   
for(int item=0; item < itemCount; item++)
{
    ::RxTabControlSetSelectedIndex(htabControl,item);
    RxSleep(100);
    printf("Page=%d\n", item+1);

    ElementStruct clientElement;
    if ( RxElementFindChild(&element, ROLE_SYSTEM_PROPERTYPAGE, NULL, NULL, &clientElement) == TRUE )
    {
        int childCount = RxElementGetChildCount(&clientElement);
        for(int i=0; i< childCount; i++)
        {
            ElementStruct tabItem;
            if ( RxElementGetChild(&clientElement, i, &tabItem) == TRUE )
            {
                printf("    Name=%s Class=%s\n", tabItem.Name, tabItem.Class);
            }
            RxSleep(100);
        }
    }
}

In a newer windows application, written with .NET, the controls of the TabControl are in the Client area:

Code: click into code to enlarge
ElementStruct element;
RxControlGetElement(htabControl, &element);
int itemCount = ::RxTabControlGetItemCount(htabControl);   
for(int item=0; item < itemCount; item++)
{
    ::RxTabControlSetSelectedIndex(htabControl,item);
    RxSleep(100);
    printf("Page=%d\n", item+1);
   
    ElementStruct clientElement;
    if ( RxElementFindChild(&element, ROLE_SYSTEM_CLIENT,
            RxTabControlGetItemText(htabControl,item), NULL, &clientElement) == TRUE )
    {
        int childCount = RxElementGetChildCount(&clientElement);
        for(int i=0; i< childCount; i++)
        {
            ElementStruct tabItem;
            if ( RxElementGetChild(&clientElement, i, &tabItem) == TRUE )
            {
                printf("    Name=%s Class=%s\n", tabItem.Name, tabItem.Class);
            }
            RxSleep(100);
        }
    }
}


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