Forum Discussion

vthomeschoolmom's avatar
vthomeschoolmom
Super Contributor
15 years ago

sstab aka tabctl32.ocx

Me and my coordinates. I hate 'em. When I record the selection of a tab in this control, it uses coordinates. I want to use ClickTab. I can SEE it in the code editor when I click on . (dot) to get my intellisense style help. But when I run, I get an error "control item 1 not found".



I tried mapping an object and MSAA for giggles. Neither helped.



This control HAS to expose the tabs, I would think. Got thoughts?



Thanks


6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    What value are you passing through to the tab?  For example are you calling 



    ClickTab("1")





    Or are you calling 



    ClickTab(1)





    There's a difference between the two.  The first example clicks on the tab with the name/caption of "1".  The second clicks on the tab with the index of 1.  



    I've been burned by this one myself that, when I'm passing data in from an Excel sheet or CSV file I forget that the data comes in, by default, as a string and that I need to appropriately cast it for the usage.
  • ClickTab(1)



    I also tried ClickTab("The actual caption of the tab")



    I get the same error in either case.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I wonder if this a similar problem to what I ran into using the TMSAdvOfficePager a few years back.  It is recognized as a tab/page control but, because of the way it is built, the individual tab items are not accessible using ClickTab, even though the ClickTab method was available.



    What I ended up having to do (and I can't find the info at my finger tips) is utilize some of the native properties and methods of the control rather than TC's helpers to actually sort through the list of available tabs and set a "current page" property (or whatever it was called) to that tab.  It wasn't exactly a "clickTab" but it simulated the effect.



    Not being familiar with your specific control, I can't give any more than that.



    BTW, if you're not already familiar with this page, check out http://smartbear.com/products/qa-tools/automated-testing/survey/



    It allows us users to give feedback to the SmartBear folks to say we'd like to see support for different control technologies.  Might be worth adding your request into this.


  • Well as a recovering VB programmer myself, I am sure I can figure that out. How do you get directly to the control's properties and methods FROM a Test Complete script? Is this something that is determined by the control itself? Do you have an example for something basic like  atext box?



    Thanks


  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Well, say have a Textbox on a page mapped with my NameMapping and Aliasing.  If I wnated to determine if the content is Editable, I'd do something like this:



    function TestCheckBox()



    {

    if Aliases.MyPage.MyTextBox.isContentEditable

    {

    Log.Message('Yup, I can edit it')

    }

    else

    {

    Log.Warning('Nope, can't do it')

    }

    }




    Essentially, any property or method visible for a component or object in the object spy is fair-game for use in your automation.  



    In the case of the TMS component, I had to do something LIKE this:



    procedure ClickTMSPagerTab(TabName);



    var

        PageArray, i,MyPage;

    begin

    PageArray := Aliases.MyApp.MyForm.OfficePageControl.pages //Note I don't remember the exact property names here

    for i := 0 to VarArrayHighBound(PageArray)-1 do begin

         if PageArray.Caption = TabName then begin

            MyPage := PageArray;

            break;

         end;

    Aliases.MyApp.MyForm.OfficePageControl.ActivePage := MyPage;

    end;




    That's the best I can remember as to how I had to manipulate the stuff.  Essentially, the ClickTab and SelectTab weren't working so I had to do effectively what the component does when someone clicks on the tab, basically assign the Active page to the by the page with the selected caption.



    Don't know if this gives you any hints as to how to proceed, but this is kind of what I'm talking about.
  • Ok I need a MASSIVE dope slap. This is COM. This is... OPEN. I can access the properties and methods of the object directly. I don't need to use Test Complete methods.



    myTab.Tab = 2 ' index of the tab I want to select.



    myGrid.Columns(3).Width = 4500 ''' set the width of the column.



    All I need is documentation for the controls the developers use, and the objects are all mine.





    Sweetness. Thanks so much for your help.