Forum Discussion

Simon_InT's avatar
Simon_InT
Contributor
7 years ago

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

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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?

    • Simon_InT's avatar
      Simon_InT
      Contributor

      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's avatar
        tristaanogre
        Esteemed Contributor

        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.

  • NisHera's avatar
    NisHera
    Valued Contributor

    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's avatar
      Simon_InT
      Contributor

      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's avatar
        tristaanogre
        Esteemed Contributor

        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.