Ask a Question

Delphi application tab selection where Visible set to False

Simon_InT
Contributor

Delphi application tab selection where Visible set to False

I have a Delphi application with multiple tabs available for selection via the UI.

 

When opening the application for the first time TestComplete object browser can only identify the default tab that is selected and the parent form only has one child. When I click on the other tabs the object browser will then identify the other tabs and the ChildCount goes up accordingly, meaning the tab names are only generated at runtime.

 

The currently selected tab property Visible is True and all the other ones are False. When I use ClickTab I get the error "The tab control is invisible and thus cannot be activated." The WndClass property of each tab is TRzTabSheet. The code looks like:

 

TestObj.ClickTab(2)

 

Even when I specify the correct Index (such as 2 in the above code) on the selected tab it returns the error "The tab control page's index 2 is out of bounds."

 


Currently the only way I have been able to switch between tabs is using screen coordinates, which is not ideal. Has anyone got any suggestions as to how to switch between tabs in a Delphi app such as this?

 

Thanks.

7 REPLIES 7
tristaanogre
Community Hero

Re: Delphi application tab selection where Visible set to False

I'm not familiar with that class.  It appears to be a class of control not necessarily supported directly by TestComplete although compiling the Delphi Application with debug info SHOULD give you all the exposed info you need.

 

What do you see when, while the application is running and before you click on them, if you use the Object Spy to investigate the individual tab controls?  Do they come up as different objects?  Are there other properties native to the TRzTabSheet that you can access that may give you a means of simulating the ClickTab?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Simon_InT
Contributor

Re: Delphi application tab selection where Visible set to False

Thanks for the reply.

 

What do you see when, while the application is running and before you click on them, if you use the Object Spy to investigate the individual tab controls?  Do they come up as different objects?

 

When I do the this the tabs do not come up as different objects, only the parent object that holds the tabs can be highlighted. Even when I click on the individual tabs they still can't be selected by the Object Spy, however they are then shown in the Object Browser.

 

Are there other properties native to the TRzTabSheet that you can access that may give you a means of simulating the ClickTab?

 

Not that I'm aware of, but I'll dig a bit deeper to find out. I've attached a screenshot to illustrate the properties associated with the currently visible tab and a second screenshot to show one of the not visible tabs. As you can see there isn't much difference apart from the Caption and Visible properties.

tristaanogre
Community Hero

Re: Delphi application tab selection where Visible set to False

So, hang on... the TRzTabSheet is the actual tab?  What is the control that contains the tab sheets?  That's the control that you want to "ClickTab" on, not the TabSheet.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
NisHera
Valued Contributor

Re: Delphi application tab selection where Visible set to False

I agrees with @tristaanogre 

Probably you are trying to click tab not yet visible, should be clicked tab from tab container.

 

You can check that up by recording your click action (only just single action), will show you which is the container owning all tabs. 

Simon_InT
Contributor

Re: Delphi application tab selection where Visible set to False

Thanks @tristaanogre and @NisHera.

 

The container that holds all the tabs uses a class called TRzPageControl. Given this is the case, what would the syntax look like to select one of the tabs? Recording the click action only gives me screen coordinates within the container, not the tab name or page index itself.

tristaanogre
Community Hero

Re: Delphi application tab selection where Visible set to False

Does TRzPageControl have a "ClickTab" method?  That's what I would use.  If it doesn't, then in your Project Properties -> Object Mapping you might want to add TRzPageControl to the Wind32 Controls and Windows | Tab Control item.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Simon_InT
Contributor

Re: Delphi application tab selection where Visible set to False

The container object of the tabs, which has TRzPageControl as the class, has ClickTab available as a method.

 

If I use containerobject.ClickTab(1) using the Index of one of the tabs or containerobject.ClickTab("Reports") using the Caption of one of the tabs I get the error "The tab control page 'Reports' not found. ".

 

I had actually already added TRzPageControl to the ObjectMapping and seemingly this does not make a difference.

cancel
Showing results for 
Search instead for 
Did you mean: