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 |